001
014
015 package com.liferay.portlet.journal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.ArrayUtil;
032 import com.liferay.portal.kernel.util.GetterUtil;
033 import com.liferay.portal.kernel.util.InstanceFactory;
034 import com.liferay.portal.kernel.util.OrderByComparator;
035 import com.liferay.portal.kernel.util.StringBundler;
036 import com.liferay.portal.kernel.util.StringPool;
037 import com.liferay.portal.kernel.util.StringUtil;
038 import com.liferay.portal.kernel.util.Validator;
039 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
040 import com.liferay.portal.model.CacheModel;
041 import com.liferay.portal.model.ModelListener;
042 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
043 import com.liferay.portal.service.persistence.BatchSessionUtil;
044 import com.liferay.portal.service.persistence.CompanyPersistence;
045 import com.liferay.portal.service.persistence.GroupPersistence;
046 import com.liferay.portal.service.persistence.ImagePersistence;
047 import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
048 import com.liferay.portal.service.persistence.ResourcePersistence;
049 import com.liferay.portal.service.persistence.SubscriptionPersistence;
050 import com.liferay.portal.service.persistence.UserPersistence;
051 import com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence;
052 import com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence;
053 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
054
055 import com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence;
056 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
057 import com.liferay.portlet.asset.service.persistence.AssetLinkPersistence;
058 import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
059 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
060 import com.liferay.portlet.journal.NoSuchArticleException;
061 import com.liferay.portlet.journal.model.JournalArticle;
062 import com.liferay.portlet.journal.model.impl.JournalArticleImpl;
063 import com.liferay.portlet.journal.model.impl.JournalArticleModelImpl;
064 import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
065 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
066
067 import java.io.Serializable;
068
069 import java.util.ArrayList;
070 import java.util.Collections;
071 import java.util.List;
072
073
085 public class JournalArticlePersistenceImpl extends BasePersistenceImpl<JournalArticle>
086 implements JournalArticlePersistence {
087
092 public static final String FINDER_CLASS_NAME_ENTITY = JournalArticleImpl.class.getName();
093 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
094 ".List1";
095 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
096 ".List2";
097 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
098 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
099 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
100 "findByUuid",
101 new String[] {
102 String.class.getName(),
103
104 "java.lang.Integer", "java.lang.Integer",
105 "com.liferay.portal.kernel.util.OrderByComparator"
106 });
107 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
108 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
109 JournalArticleImpl.class,
110 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
111 new String[] { String.class.getName() },
112 JournalArticleModelImpl.UUID_COLUMN_BITMASK);
113 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
114 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
115 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
116 new String[] { String.class.getName() });
117 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
118 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
119 JournalArticleImpl.class, FINDER_CLASS_NAME_ENTITY,
120 "fetchByUUID_G",
121 new String[] { String.class.getName(), Long.class.getName() },
122 JournalArticleModelImpl.UUID_COLUMN_BITMASK |
123 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK);
124 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
125 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
126 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
127 new String[] { String.class.getName(), Long.class.getName() });
128 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_RESOURCEPRIMKEY =
129 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
130 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
131 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
132 "findByResourcePrimKey",
133 new String[] {
134 Long.class.getName(),
135
136 "java.lang.Integer", "java.lang.Integer",
137 "com.liferay.portal.kernel.util.OrderByComparator"
138 });
139 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESOURCEPRIMKEY =
140 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
141 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
142 JournalArticleImpl.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByResourcePrimKey",
144 new String[] { Long.class.getName() },
145 JournalArticleModelImpl.RESOURCEPRIMKEY_COLUMN_BITMASK);
146 public static final FinderPath FINDER_PATH_COUNT_BY_RESOURCEPRIMKEY = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
147 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
148 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
149 "countByResourcePrimKey", new String[] { Long.class.getName() });
150 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
151 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
152 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
153 "findByGroupId",
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_GROUPID =
161 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
162 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
163 JournalArticleImpl.class,
164 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
165 new String[] { Long.class.getName() },
166 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK);
167 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
168 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
169 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
170 new String[] { Long.class.getName() });
171 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
172 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
173 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
174 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
175 "findByCompanyId",
176 new String[] {
177 Long.class.getName(),
178
179 "java.lang.Integer", "java.lang.Integer",
180 "com.liferay.portal.kernel.util.OrderByComparator"
181 });
182 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
183 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
184 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
185 JournalArticleImpl.class,
186 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
187 new String[] { Long.class.getName() },
188 JournalArticleModelImpl.COMPANYID_COLUMN_BITMASK);
189 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
190 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
191 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
192 new String[] { Long.class.getName() });
193 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_STRUCTUREID =
194 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
195 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
196 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
197 "findByStructureId",
198 new String[] {
199 String.class.getName(),
200
201 "java.lang.Integer", "java.lang.Integer",
202 "com.liferay.portal.kernel.util.OrderByComparator"
203 });
204 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID =
205 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
206 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
207 JournalArticleImpl.class,
208 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByStructureId",
209 new String[] { String.class.getName() },
210 JournalArticleModelImpl.STRUCTUREID_COLUMN_BITMASK);
211 public static final FinderPath FINDER_PATH_COUNT_BY_STRUCTUREID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
212 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
213 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByStructureId",
214 new String[] { String.class.getName() });
215 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TEMPLATEID =
216 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
217 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
218 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
219 "findByTemplateId",
220 new String[] {
221 String.class.getName(),
222
223 "java.lang.Integer", "java.lang.Integer",
224 "com.liferay.portal.kernel.util.OrderByComparator"
225 });
226 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEMPLATEID =
227 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
228 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
229 JournalArticleImpl.class,
230 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByTemplateId",
231 new String[] { String.class.getName() },
232 JournalArticleModelImpl.TEMPLATEID_COLUMN_BITMASK);
233 public static final FinderPath FINDER_PATH_COUNT_BY_TEMPLATEID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
234 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
235 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByTemplateId",
236 new String[] { String.class.getName() });
237 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_LAYOUTUUID =
238 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
239 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
240 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
241 "findByLayoutUuid",
242 new String[] {
243 String.class.getName(),
244
245 "java.lang.Integer", "java.lang.Integer",
246 "com.liferay.portal.kernel.util.OrderByComparator"
247 });
248 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTUUID =
249 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
250 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
251 JournalArticleImpl.class,
252 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByLayoutUuid",
253 new String[] { String.class.getName() },
254 JournalArticleModelImpl.LAYOUTUUID_COLUMN_BITMASK);
255 public static final FinderPath FINDER_PATH_COUNT_BY_LAYOUTUUID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
256 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
257 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByLayoutUuid",
258 new String[] { String.class.getName() });
259 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SMALLIMAGEID =
260 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
261 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
262 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
263 "findBySmallImageId",
264 new String[] {
265 Long.class.getName(),
266
267 "java.lang.Integer", "java.lang.Integer",
268 "com.liferay.portal.kernel.util.OrderByComparator"
269 });
270 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SMALLIMAGEID =
271 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
272 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
273 JournalArticleImpl.class,
274 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBySmallImageId",
275 new String[] { Long.class.getName() },
276 JournalArticleModelImpl.SMALLIMAGEID_COLUMN_BITMASK);
277 public static final FinderPath FINDER_PATH_COUNT_BY_SMALLIMAGEID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
278 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
279 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBySmallImageId",
280 new String[] { Long.class.getName() });
281 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_R_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
282 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
283 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
284 "findByR_ST",
285 new String[] {
286 Long.class.getName(), Integer.class.getName(),
287
288 "java.lang.Integer", "java.lang.Integer",
289 "com.liferay.portal.kernel.util.OrderByComparator"
290 });
291 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_R_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
292 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
293 JournalArticleImpl.class,
294 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByR_ST",
295 new String[] { Long.class.getName(), Integer.class.getName() },
296 JournalArticleModelImpl.RESOURCEPRIMKEY_COLUMN_BITMASK |
297 JournalArticleModelImpl.STATUS_COLUMN_BITMASK);
298 public static final FinderPath FINDER_PATH_COUNT_BY_R_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
299 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
300 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByR_ST",
301 new String[] { Long.class.getName(), Integer.class.getName() });
302 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_A = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
303 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
304 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
305 "findByG_A",
306 new String[] {
307 Long.class.getName(), String.class.getName(),
308
309 "java.lang.Integer", "java.lang.Integer",
310 "com.liferay.portal.kernel.util.OrderByComparator"
311 });
312 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
313 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
314 JournalArticleImpl.class,
315 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_A",
316 new String[] { Long.class.getName(), String.class.getName() },
317 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
318 JournalArticleModelImpl.ARTICLEID_COLUMN_BITMASK);
319 public static final FinderPath FINDER_PATH_COUNT_BY_G_A = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
320 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
321 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_A",
322 new String[] { Long.class.getName(), String.class.getName() });
323 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_UT = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
324 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
325 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
326 "findByG_UT",
327 new String[] {
328 Long.class.getName(), String.class.getName(),
329
330 "java.lang.Integer", "java.lang.Integer",
331 "com.liferay.portal.kernel.util.OrderByComparator"
332 });
333 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
334 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
335 JournalArticleImpl.class,
336 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_UT",
337 new String[] { Long.class.getName(), String.class.getName() },
338 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
339 JournalArticleModelImpl.URLTITLE_COLUMN_BITMASK);
340 public static final FinderPath FINDER_PATH_COUNT_BY_G_UT = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
341 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
342 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_UT",
343 new String[] { Long.class.getName(), String.class.getName() });
344 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
345 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
346 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
347 "findByG_S",
348 new String[] {
349 Long.class.getName(), String.class.getName(),
350
351 "java.lang.Integer", "java.lang.Integer",
352 "com.liferay.portal.kernel.util.OrderByComparator"
353 });
354 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
355 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
356 JournalArticleImpl.class,
357 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S",
358 new String[] { Long.class.getName(), String.class.getName() },
359 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
360 JournalArticleModelImpl.STRUCTUREID_COLUMN_BITMASK);
361 public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
362 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
363 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_S",
364 new String[] { Long.class.getName(), String.class.getName() });
365 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
366 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
367 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
368 "findByG_T",
369 new String[] {
370 Long.class.getName(), String.class.getName(),
371
372 "java.lang.Integer", "java.lang.Integer",
373 "com.liferay.portal.kernel.util.OrderByComparator"
374 });
375 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
376 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
377 JournalArticleImpl.class,
378 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_T",
379 new String[] { Long.class.getName(), String.class.getName() },
380 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
381 JournalArticleModelImpl.TEMPLATEID_COLUMN_BITMASK);
382 public static final FinderPath FINDER_PATH_COUNT_BY_G_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
383 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
384 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_T",
385 new String[] { Long.class.getName(), String.class.getName() });
386 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_L = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
387 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
388 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
389 "findByG_L",
390 new String[] {
391 Long.class.getName(), String.class.getName(),
392
393 "java.lang.Integer", "java.lang.Integer",
394 "com.liferay.portal.kernel.util.OrderByComparator"
395 });
396 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_L = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
397 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
398 JournalArticleImpl.class,
399 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_L",
400 new String[] { Long.class.getName(), String.class.getName() },
401 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
402 JournalArticleModelImpl.LAYOUTUUID_COLUMN_BITMASK);
403 public static final FinderPath FINDER_PATH_COUNT_BY_G_L = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
404 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
405 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_L",
406 new String[] { Long.class.getName(), String.class.getName() });
407 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
408 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
409 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
410 "findByG_ST",
411 new String[] {
412 Long.class.getName(), Integer.class.getName(),
413
414 "java.lang.Integer", "java.lang.Integer",
415 "com.liferay.portal.kernel.util.OrderByComparator"
416 });
417 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
418 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
419 JournalArticleImpl.class,
420 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_ST",
421 new String[] { Long.class.getName(), Integer.class.getName() },
422 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
423 JournalArticleModelImpl.STATUS_COLUMN_BITMASK);
424 public static final FinderPath FINDER_PATH_COUNT_BY_G_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
425 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
426 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_ST",
427 new String[] { Long.class.getName(), Integer.class.getName() });
428 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_V = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
429 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
430 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
431 "findByC_V",
432 new String[] {
433 Long.class.getName(), Double.class.getName(),
434
435 "java.lang.Integer", "java.lang.Integer",
436 "com.liferay.portal.kernel.util.OrderByComparator"
437 });
438 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
439 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
440 JournalArticleImpl.class,
441 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_V",
442 new String[] { Long.class.getName(), Double.class.getName() },
443 JournalArticleModelImpl.COMPANYID_COLUMN_BITMASK |
444 JournalArticleModelImpl.VERSION_COLUMN_BITMASK);
445 public static final FinderPath FINDER_PATH_COUNT_BY_C_V = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
446 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
447 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_V",
448 new String[] { Long.class.getName(), Double.class.getName() });
449 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
450 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
451 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
452 "findByC_ST",
453 new String[] {
454 Long.class.getName(), Integer.class.getName(),
455
456 "java.lang.Integer", "java.lang.Integer",
457 "com.liferay.portal.kernel.util.OrderByComparator"
458 });
459 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
460 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
461 JournalArticleImpl.class,
462 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_ST",
463 new String[] { Long.class.getName(), Integer.class.getName() },
464 JournalArticleModelImpl.COMPANYID_COLUMN_BITMASK |
465 JournalArticleModelImpl.STATUS_COLUMN_BITMASK);
466 public static final FinderPath FINDER_PATH_COUNT_BY_C_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
467 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
468 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_ST",
469 new String[] { Long.class.getName(), Integer.class.getName() });
470 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_C_C = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
471 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
472 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
473 "findByG_C_C",
474 new String[] {
475 Long.class.getName(), Long.class.getName(), Long.class.getName(),
476
477 "java.lang.Integer", "java.lang.Integer",
478 "com.liferay.portal.kernel.util.OrderByComparator"
479 });
480 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_C = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
481 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
482 JournalArticleImpl.class,
483 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_C_C",
484 new String[] {
485 Long.class.getName(), Long.class.getName(), Long.class.getName()
486 },
487 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
488 JournalArticleModelImpl.CLASSNAMEID_COLUMN_BITMASK |
489 JournalArticleModelImpl.CLASSPK_COLUMN_BITMASK);
490 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_C = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
491 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
492 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_C_C",
493 new String[] {
494 Long.class.getName(), Long.class.getName(), Long.class.getName()
495 });
496 public static final FinderPath FINDER_PATH_FETCH_BY_G_C_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
497 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
498 JournalArticleImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByG_C_S",
499 new String[] {
500 Long.class.getName(), Long.class.getName(),
501 String.class.getName()
502 },
503 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
504 JournalArticleModelImpl.CLASSNAMEID_COLUMN_BITMASK |
505 JournalArticleModelImpl.STRUCTUREID_COLUMN_BITMASK);
506 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
507 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
508 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_C_S",
509 new String[] {
510 Long.class.getName(), Long.class.getName(),
511 String.class.getName()
512 });
513 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_C_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
514 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
515 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
516 "findByG_C_T",
517 new String[] {
518 Long.class.getName(), Long.class.getName(),
519 String.class.getName(),
520
521 "java.lang.Integer", "java.lang.Integer",
522 "com.liferay.portal.kernel.util.OrderByComparator"
523 });
524 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
525 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
526 JournalArticleImpl.class,
527 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_C_T",
528 new String[] {
529 Long.class.getName(), Long.class.getName(),
530 String.class.getName()
531 },
532 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
533 JournalArticleModelImpl.CLASSNAMEID_COLUMN_BITMASK |
534 JournalArticleModelImpl.TEMPLATEID_COLUMN_BITMASK);
535 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
536 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
537 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_C_T",
538 new String[] {
539 Long.class.getName(), Long.class.getName(),
540 String.class.getName()
541 });
542 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_C_L = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
543 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
544 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
545 "findByG_C_L",
546 new String[] {
547 Long.class.getName(), Long.class.getName(),
548 String.class.getName(),
549
550 "java.lang.Integer", "java.lang.Integer",
551 "com.liferay.portal.kernel.util.OrderByComparator"
552 });
553 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_L = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
554 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
555 JournalArticleImpl.class,
556 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_C_L",
557 new String[] {
558 Long.class.getName(), Long.class.getName(),
559 String.class.getName()
560 },
561 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
562 JournalArticleModelImpl.CLASSNAMEID_COLUMN_BITMASK |
563 JournalArticleModelImpl.LAYOUTUUID_COLUMN_BITMASK);
564 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_L = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
565 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
566 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_C_L",
567 new String[] {
568 Long.class.getName(), Long.class.getName(),
569 String.class.getName()
570 });
571 public static final FinderPath FINDER_PATH_FETCH_BY_G_A_V = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
572 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
573 JournalArticleImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByG_A_V",
574 new String[] {
575 Long.class.getName(), String.class.getName(),
576 Double.class.getName()
577 },
578 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
579 JournalArticleModelImpl.ARTICLEID_COLUMN_BITMASK |
580 JournalArticleModelImpl.VERSION_COLUMN_BITMASK);
581 public static final FinderPath FINDER_PATH_COUNT_BY_G_A_V = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
582 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
583 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_A_V",
584 new String[] {
585 Long.class.getName(), String.class.getName(),
586 Double.class.getName()
587 });
588 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_A_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
589 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
590 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
591 "findByG_A_ST",
592 new String[] {
593 Long.class.getName(), String.class.getName(),
594 Integer.class.getName(),
595
596 "java.lang.Integer", "java.lang.Integer",
597 "com.liferay.portal.kernel.util.OrderByComparator"
598 });
599 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_ST =
600 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
601 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
602 JournalArticleImpl.class,
603 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_A_ST",
604 new String[] {
605 Long.class.getName(), String.class.getName(),
606 Integer.class.getName()
607 },
608 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
609 JournalArticleModelImpl.ARTICLEID_COLUMN_BITMASK |
610 JournalArticleModelImpl.STATUS_COLUMN_BITMASK);
611 public static final FinderPath FINDER_PATH_COUNT_BY_G_A_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
612 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
613 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_A_ST",
614 new String[] {
615 Long.class.getName(), String.class.getName(),
616 Integer.class.getName()
617 });
618 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_A_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
619 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
620 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_A_ST",
621 new String[] {
622 Long.class.getName(), String.class.getName(),
623 Integer.class.getName()
624 });
625 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_UT_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
626 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
627 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
628 "findByG_UT_ST",
629 new String[] {
630 Long.class.getName(), String.class.getName(),
631 Integer.class.getName(),
632
633 "java.lang.Integer", "java.lang.Integer",
634 "com.liferay.portal.kernel.util.OrderByComparator"
635 });
636 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT_ST =
637 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
638 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
639 JournalArticleImpl.class,
640 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_UT_ST",
641 new String[] {
642 Long.class.getName(), String.class.getName(),
643 Integer.class.getName()
644 },
645 JournalArticleModelImpl.GROUPID_COLUMN_BITMASK |
646 JournalArticleModelImpl.URLTITLE_COLUMN_BITMASK |
647 JournalArticleModelImpl.STATUS_COLUMN_BITMASK);
648 public static final FinderPath FINDER_PATH_COUNT_BY_G_UT_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
649 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
650 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_UT_ST",
651 new String[] {
652 Long.class.getName(), String.class.getName(),
653 Integer.class.getName()
654 });
655 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_V_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
656 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
657 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
658 "findByC_V_ST",
659 new String[] {
660 Long.class.getName(), Double.class.getName(),
661 Integer.class.getName(),
662
663 "java.lang.Integer", "java.lang.Integer",
664 "com.liferay.portal.kernel.util.OrderByComparator"
665 });
666 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V_ST =
667 new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
668 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
669 JournalArticleImpl.class,
670 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_V_ST",
671 new String[] {
672 Long.class.getName(), Double.class.getName(),
673 Integer.class.getName()
674 },
675 JournalArticleModelImpl.COMPANYID_COLUMN_BITMASK |
676 JournalArticleModelImpl.VERSION_COLUMN_BITMASK |
677 JournalArticleModelImpl.STATUS_COLUMN_BITMASK);
678 public static final FinderPath FINDER_PATH_COUNT_BY_C_V_ST = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
679 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
680 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_V_ST",
681 new String[] {
682 Long.class.getName(), Double.class.getName(),
683 Integer.class.getName()
684 });
685 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
686 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
687 JournalArticleImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
688 "findAll", new String[0]);
689 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
690 JournalArticleModelImpl.FINDER_CACHE_ENABLED,
691 JournalArticleImpl.class,
692 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
693 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
694 JournalArticleModelImpl.FINDER_CACHE_ENABLED, Long.class,
695 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
696
697
702 public void cacheResult(JournalArticle journalArticle) {
703 EntityCacheUtil.putResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
704 JournalArticleImpl.class, journalArticle.getPrimaryKey(),
705 journalArticle);
706
707 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
708 new Object[] {
709 journalArticle.getUuid(),
710 Long.valueOf(journalArticle.getGroupId())
711 }, journalArticle);
712
713 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_S,
714 new Object[] {
715 Long.valueOf(journalArticle.getGroupId()),
716 Long.valueOf(journalArticle.getClassNameId()),
717
718 journalArticle.getStructureId()
719 }, journalArticle);
720
721 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
722 new Object[] {
723 Long.valueOf(journalArticle.getGroupId()),
724
725 journalArticle.getArticleId(),
726 Double.valueOf(journalArticle.getVersion())
727 }, journalArticle);
728
729 journalArticle.resetOriginalValues();
730 }
731
732
737 public void cacheResult(List<JournalArticle> journalArticles) {
738 for (JournalArticle journalArticle : journalArticles) {
739 if (EntityCacheUtil.getResult(
740 JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
741 JournalArticleImpl.class, journalArticle.getPrimaryKey()) == null) {
742 cacheResult(journalArticle);
743 }
744 else {
745 journalArticle.resetOriginalValues();
746 }
747 }
748 }
749
750
757 @Override
758 public void clearCache() {
759 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
760 CacheRegistryUtil.clear(JournalArticleImpl.class.getName());
761 }
762
763 EntityCacheUtil.clearCache(JournalArticleImpl.class.getName());
764
765 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
766 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
767 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
768 }
769
770
777 @Override
778 public void clearCache(JournalArticle journalArticle) {
779 EntityCacheUtil.removeResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
780 JournalArticleImpl.class, journalArticle.getPrimaryKey());
781
782 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
783 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
784
785 clearUniqueFindersCache(journalArticle);
786 }
787
788 @Override
789 public void clearCache(List<JournalArticle> journalArticles) {
790 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
791 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
792
793 for (JournalArticle journalArticle : journalArticles) {
794 EntityCacheUtil.removeResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
795 JournalArticleImpl.class, journalArticle.getPrimaryKey());
796
797 clearUniqueFindersCache(journalArticle);
798 }
799 }
800
801 protected void cacheUniqueFindersCache(JournalArticle journalArticle) {
802 if (journalArticle.isNew()) {
803 Object[] args = new Object[] {
804 journalArticle.getUuid(),
805 Long.valueOf(journalArticle.getGroupId())
806 };
807
808 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args,
809 Long.valueOf(1));
810 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args,
811 journalArticle);
812
813 args = new Object[] {
814 Long.valueOf(journalArticle.getGroupId()),
815 Long.valueOf(journalArticle.getClassNameId()),
816
817 journalArticle.getStructureId()
818 };
819
820 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_S, args,
821 Long.valueOf(1));
822 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_S, args,
823 journalArticle);
824
825 args = new Object[] {
826 Long.valueOf(journalArticle.getGroupId()),
827
828 journalArticle.getArticleId(),
829 Double.valueOf(journalArticle.getVersion())
830 };
831
832 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_V, args,
833 Long.valueOf(1));
834 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V, args,
835 journalArticle);
836 }
837 else {
838 JournalArticleModelImpl journalArticleModelImpl = (JournalArticleModelImpl)journalArticle;
839
840 if ((journalArticleModelImpl.getColumnBitmask() &
841 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
842 Object[] args = new Object[] {
843 journalArticle.getUuid(),
844 Long.valueOf(journalArticle.getGroupId())
845 };
846
847 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args,
848 Long.valueOf(1));
849 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args,
850 journalArticle);
851 }
852
853 if ((journalArticleModelImpl.getColumnBitmask() &
854 FINDER_PATH_FETCH_BY_G_C_S.getColumnBitmask()) != 0) {
855 Object[] args = new Object[] {
856 Long.valueOf(journalArticle.getGroupId()),
857 Long.valueOf(journalArticle.getClassNameId()),
858
859 journalArticle.getStructureId()
860 };
861
862 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_S, args,
863 Long.valueOf(1));
864 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_S, args,
865 journalArticle);
866 }
867
868 if ((journalArticleModelImpl.getColumnBitmask() &
869 FINDER_PATH_FETCH_BY_G_A_V.getColumnBitmask()) != 0) {
870 Object[] args = new Object[] {
871 Long.valueOf(journalArticle.getGroupId()),
872
873 journalArticle.getArticleId(),
874 Double.valueOf(journalArticle.getVersion())
875 };
876
877 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_V, args,
878 Long.valueOf(1));
879 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V, args,
880 journalArticle);
881 }
882 }
883 }
884
885 protected void clearUniqueFindersCache(JournalArticle journalArticle) {
886 JournalArticleModelImpl journalArticleModelImpl = (JournalArticleModelImpl)journalArticle;
887
888 Object[] args = new Object[] {
889 journalArticle.getUuid(),
890 Long.valueOf(journalArticle.getGroupId())
891 };
892
893 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
894 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
895
896 if ((journalArticleModelImpl.getColumnBitmask() &
897 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
898 args = new Object[] {
899 journalArticleModelImpl.getOriginalUuid(),
900 Long.valueOf(journalArticleModelImpl.getOriginalGroupId())
901 };
902
903 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
904 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
905 }
906
907 args = new Object[] {
908 Long.valueOf(journalArticle.getGroupId()),
909 Long.valueOf(journalArticle.getClassNameId()),
910
911 journalArticle.getStructureId()
912 };
913
914 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_S, args);
915 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_S, args);
916
917 if ((journalArticleModelImpl.getColumnBitmask() &
918 FINDER_PATH_FETCH_BY_G_C_S.getColumnBitmask()) != 0) {
919 args = new Object[] {
920 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
921 Long.valueOf(journalArticleModelImpl.getOriginalClassNameId()),
922
923 journalArticleModelImpl.getOriginalStructureId()
924 };
925
926 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_S, args);
927 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_S, args);
928 }
929
930 args = new Object[] {
931 Long.valueOf(journalArticle.getGroupId()),
932
933 journalArticle.getArticleId(),
934 Double.valueOf(journalArticle.getVersion())
935 };
936
937 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_V, args);
938 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V, args);
939
940 if ((journalArticleModelImpl.getColumnBitmask() &
941 FINDER_PATH_FETCH_BY_G_A_V.getColumnBitmask()) != 0) {
942 args = new Object[] {
943 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
944
945 journalArticleModelImpl.getOriginalArticleId(),
946 Double.valueOf(journalArticleModelImpl.getOriginalVersion())
947 };
948
949 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_V, args);
950 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V, args);
951 }
952 }
953
954
960 public JournalArticle create(long id) {
961 JournalArticle journalArticle = new JournalArticleImpl();
962
963 journalArticle.setNew(true);
964 journalArticle.setPrimaryKey(id);
965
966 String uuid = PortalUUIDUtil.generate();
967
968 journalArticle.setUuid(uuid);
969
970 return journalArticle;
971 }
972
973
981 public JournalArticle remove(long id)
982 throws NoSuchArticleException, SystemException {
983 return remove(Long.valueOf(id));
984 }
985
986
994 @Override
995 public JournalArticle remove(Serializable primaryKey)
996 throws NoSuchArticleException, SystemException {
997 Session session = null;
998
999 try {
1000 session = openSession();
1001
1002 JournalArticle journalArticle = (JournalArticle)session.get(JournalArticleImpl.class,
1003 primaryKey);
1004
1005 if (journalArticle == null) {
1006 if (_log.isWarnEnabled()) {
1007 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1008 }
1009
1010 throw new NoSuchArticleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1011 primaryKey);
1012 }
1013
1014 return remove(journalArticle);
1015 }
1016 catch (NoSuchArticleException nsee) {
1017 throw nsee;
1018 }
1019 catch (Exception e) {
1020 throw processException(e);
1021 }
1022 finally {
1023 closeSession(session);
1024 }
1025 }
1026
1027 @Override
1028 protected JournalArticle removeImpl(JournalArticle journalArticle)
1029 throws SystemException {
1030 journalArticle = toUnwrappedModel(journalArticle);
1031
1032 Session session = null;
1033
1034 try {
1035 session = openSession();
1036
1037 BatchSessionUtil.delete(session, journalArticle);
1038 }
1039 catch (Exception e) {
1040 throw processException(e);
1041 }
1042 finally {
1043 closeSession(session);
1044 }
1045
1046 clearCache(journalArticle);
1047
1048 return journalArticle;
1049 }
1050
1051 @Override
1052 public JournalArticle updateImpl(
1053 com.liferay.portlet.journal.model.JournalArticle journalArticle,
1054 boolean merge) throws SystemException {
1055 journalArticle = toUnwrappedModel(journalArticle);
1056
1057 boolean isNew = journalArticle.isNew();
1058
1059 JournalArticleModelImpl journalArticleModelImpl = (JournalArticleModelImpl)journalArticle;
1060
1061 if (Validator.isNull(journalArticle.getUuid())) {
1062 String uuid = PortalUUIDUtil.generate();
1063
1064 journalArticle.setUuid(uuid);
1065 }
1066
1067 Session session = null;
1068
1069 try {
1070 session = openSession();
1071
1072 BatchSessionUtil.update(session, journalArticle, merge);
1073
1074 journalArticle.setNew(false);
1075 }
1076 catch (Exception e) {
1077 throw processException(e);
1078 }
1079 finally {
1080 closeSession(session);
1081 }
1082
1083 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1084
1085 if (isNew || !JournalArticleModelImpl.COLUMN_BITMASK_ENABLED) {
1086 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1087 }
1088
1089 else {
1090 if ((journalArticleModelImpl.getColumnBitmask() &
1091 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
1092 Object[] args = new Object[] {
1093 journalArticleModelImpl.getOriginalUuid()
1094 };
1095
1096 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
1097 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
1098 args);
1099
1100 args = new Object[] { journalArticleModelImpl.getUuid() };
1101
1102 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
1103 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
1104 args);
1105 }
1106
1107 if ((journalArticleModelImpl.getColumnBitmask() &
1108 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESOURCEPRIMKEY.getColumnBitmask()) != 0) {
1109 Object[] args = new Object[] {
1110 Long.valueOf(journalArticleModelImpl.getOriginalResourcePrimKey())
1111 };
1112
1113 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RESOURCEPRIMKEY,
1114 args);
1115 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESOURCEPRIMKEY,
1116 args);
1117
1118 args = new Object[] {
1119 Long.valueOf(journalArticleModelImpl.getResourcePrimKey())
1120 };
1121
1122 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RESOURCEPRIMKEY,
1123 args);
1124 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESOURCEPRIMKEY,
1125 args);
1126 }
1127
1128 if ((journalArticleModelImpl.getColumnBitmask() &
1129 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
1130 Object[] args = new Object[] {
1131 Long.valueOf(journalArticleModelImpl.getOriginalGroupId())
1132 };
1133
1134 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
1135 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
1136 args);
1137
1138 args = new Object[] {
1139 Long.valueOf(journalArticleModelImpl.getGroupId())
1140 };
1141
1142 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
1143 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
1144 args);
1145 }
1146
1147 if ((journalArticleModelImpl.getColumnBitmask() &
1148 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
1149 Object[] args = new Object[] {
1150 Long.valueOf(journalArticleModelImpl.getOriginalCompanyId())
1151 };
1152
1153 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
1154 args);
1155 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
1156 args);
1157
1158 args = new Object[] {
1159 Long.valueOf(journalArticleModelImpl.getCompanyId())
1160 };
1161
1162 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
1163 args);
1164 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
1165 args);
1166 }
1167
1168 if ((journalArticleModelImpl.getColumnBitmask() &
1169 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID.getColumnBitmask()) != 0) {
1170 Object[] args = new Object[] {
1171 journalArticleModelImpl.getOriginalStructureId()
1172 };
1173
1174 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1175 args);
1176 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID,
1177 args);
1178
1179 args = new Object[] { journalArticleModelImpl.getStructureId() };
1180
1181 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1182 args);
1183 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID,
1184 args);
1185 }
1186
1187 if ((journalArticleModelImpl.getColumnBitmask() &
1188 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEMPLATEID.getColumnBitmask()) != 0) {
1189 Object[] args = new Object[] {
1190 journalArticleModelImpl.getOriginalTemplateId()
1191 };
1192
1193 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
1194 args);
1195 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEMPLATEID,
1196 args);
1197
1198 args = new Object[] { journalArticleModelImpl.getTemplateId() };
1199
1200 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
1201 args);
1202 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEMPLATEID,
1203 args);
1204 }
1205
1206 if ((journalArticleModelImpl.getColumnBitmask() &
1207 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTUUID.getColumnBitmask()) != 0) {
1208 Object[] args = new Object[] {
1209 journalArticleModelImpl.getOriginalLayoutUuid()
1210 };
1211
1212 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_LAYOUTUUID,
1213 args);
1214 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTUUID,
1215 args);
1216
1217 args = new Object[] { journalArticleModelImpl.getLayoutUuid() };
1218
1219 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_LAYOUTUUID,
1220 args);
1221 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTUUID,
1222 args);
1223 }
1224
1225 if ((journalArticleModelImpl.getColumnBitmask() &
1226 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SMALLIMAGEID.getColumnBitmask()) != 0) {
1227 Object[] args = new Object[] {
1228 Long.valueOf(journalArticleModelImpl.getOriginalSmallImageId())
1229 };
1230
1231 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
1232 args);
1233 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SMALLIMAGEID,
1234 args);
1235
1236 args = new Object[] {
1237 Long.valueOf(journalArticleModelImpl.getSmallImageId())
1238 };
1239
1240 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
1241 args);
1242 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SMALLIMAGEID,
1243 args);
1244 }
1245
1246 if ((journalArticleModelImpl.getColumnBitmask() &
1247 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_R_ST.getColumnBitmask()) != 0) {
1248 Object[] args = new Object[] {
1249 Long.valueOf(journalArticleModelImpl.getOriginalResourcePrimKey()),
1250 Integer.valueOf(journalArticleModelImpl.getOriginalStatus())
1251 };
1252
1253 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_R_ST, args);
1254 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_R_ST,
1255 args);
1256
1257 args = new Object[] {
1258 Long.valueOf(journalArticleModelImpl.getResourcePrimKey()),
1259 Integer.valueOf(journalArticleModelImpl.getStatus())
1260 };
1261
1262 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_R_ST, args);
1263 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_R_ST,
1264 args);
1265 }
1266
1267 if ((journalArticleModelImpl.getColumnBitmask() &
1268 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A.getColumnBitmask()) != 0) {
1269 Object[] args = new Object[] {
1270 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1271
1272 journalArticleModelImpl.getOriginalArticleId()
1273 };
1274
1275 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A, args);
1276 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A,
1277 args);
1278
1279 args = new Object[] {
1280 Long.valueOf(journalArticleModelImpl.getGroupId()),
1281
1282 journalArticleModelImpl.getArticleId()
1283 };
1284
1285 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A, args);
1286 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A,
1287 args);
1288 }
1289
1290 if ((journalArticleModelImpl.getColumnBitmask() &
1291 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT.getColumnBitmask()) != 0) {
1292 Object[] args = new Object[] {
1293 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1294
1295 journalArticleModelImpl.getOriginalUrlTitle()
1296 };
1297
1298 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_UT, args);
1299 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT,
1300 args);
1301
1302 args = new Object[] {
1303 Long.valueOf(journalArticleModelImpl.getGroupId()),
1304
1305 journalArticleModelImpl.getUrlTitle()
1306 };
1307
1308 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_UT, args);
1309 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT,
1310 args);
1311 }
1312
1313 if ((journalArticleModelImpl.getColumnBitmask() &
1314 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
1315 Object[] args = new Object[] {
1316 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1317
1318 journalArticleModelImpl.getOriginalStructureId()
1319 };
1320
1321 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
1322 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
1323 args);
1324
1325 args = new Object[] {
1326 Long.valueOf(journalArticleModelImpl.getGroupId()),
1327
1328 journalArticleModelImpl.getStructureId()
1329 };
1330
1331 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
1332 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
1333 args);
1334 }
1335
1336 if ((journalArticleModelImpl.getColumnBitmask() &
1337 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T.getColumnBitmask()) != 0) {
1338 Object[] args = new Object[] {
1339 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1340
1341 journalArticleModelImpl.getOriginalTemplateId()
1342 };
1343
1344 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_T, args);
1345 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T,
1346 args);
1347
1348 args = new Object[] {
1349 Long.valueOf(journalArticleModelImpl.getGroupId()),
1350
1351 journalArticleModelImpl.getTemplateId()
1352 };
1353
1354 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_T, args);
1355 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T,
1356 args);
1357 }
1358
1359 if ((journalArticleModelImpl.getColumnBitmask() &
1360 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_L.getColumnBitmask()) != 0) {
1361 Object[] args = new Object[] {
1362 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1363
1364 journalArticleModelImpl.getOriginalLayoutUuid()
1365 };
1366
1367 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_L, args);
1368 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_L,
1369 args);
1370
1371 args = new Object[] {
1372 Long.valueOf(journalArticleModelImpl.getGroupId()),
1373
1374 journalArticleModelImpl.getLayoutUuid()
1375 };
1376
1377 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_L, args);
1378 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_L,
1379 args);
1380 }
1381
1382 if ((journalArticleModelImpl.getColumnBitmask() &
1383 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_ST.getColumnBitmask()) != 0) {
1384 Object[] args = new Object[] {
1385 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1386 Integer.valueOf(journalArticleModelImpl.getOriginalStatus())
1387 };
1388
1389 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_ST, args);
1390 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_ST,
1391 args);
1392
1393 args = new Object[] {
1394 Long.valueOf(journalArticleModelImpl.getGroupId()),
1395 Integer.valueOf(journalArticleModelImpl.getStatus())
1396 };
1397
1398 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_ST, args);
1399 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_ST,
1400 args);
1401 }
1402
1403 if ((journalArticleModelImpl.getColumnBitmask() &
1404 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V.getColumnBitmask()) != 0) {
1405 Object[] args = new Object[] {
1406 Long.valueOf(journalArticleModelImpl.getOriginalCompanyId()),
1407 Double.valueOf(journalArticleModelImpl.getOriginalVersion())
1408 };
1409
1410 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_V, args);
1411 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V,
1412 args);
1413
1414 args = new Object[] {
1415 Long.valueOf(journalArticleModelImpl.getCompanyId()),
1416 Double.valueOf(journalArticleModelImpl.getVersion())
1417 };
1418
1419 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_V, args);
1420 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V,
1421 args);
1422 }
1423
1424 if ((journalArticleModelImpl.getColumnBitmask() &
1425 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_ST.getColumnBitmask()) != 0) {
1426 Object[] args = new Object[] {
1427 Long.valueOf(journalArticleModelImpl.getOriginalCompanyId()),
1428 Integer.valueOf(journalArticleModelImpl.getOriginalStatus())
1429 };
1430
1431 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_ST, args);
1432 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_ST,
1433 args);
1434
1435 args = new Object[] {
1436 Long.valueOf(journalArticleModelImpl.getCompanyId()),
1437 Integer.valueOf(journalArticleModelImpl.getStatus())
1438 };
1439
1440 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_ST, args);
1441 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_ST,
1442 args);
1443 }
1444
1445 if ((journalArticleModelImpl.getColumnBitmask() &
1446 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_C.getColumnBitmask()) != 0) {
1447 Object[] args = new Object[] {
1448 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1449 Long.valueOf(journalArticleModelImpl.getOriginalClassNameId()),
1450 Long.valueOf(journalArticleModelImpl.getOriginalClassPK())
1451 };
1452
1453 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_C, args);
1454 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_C,
1455 args);
1456
1457 args = new Object[] {
1458 Long.valueOf(journalArticleModelImpl.getGroupId()),
1459 Long.valueOf(journalArticleModelImpl.getClassNameId()),
1460 Long.valueOf(journalArticleModelImpl.getClassPK())
1461 };
1462
1463 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_C, args);
1464 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_C,
1465 args);
1466 }
1467
1468 if ((journalArticleModelImpl.getColumnBitmask() &
1469 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_T.getColumnBitmask()) != 0) {
1470 Object[] args = new Object[] {
1471 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1472 Long.valueOf(journalArticleModelImpl.getOriginalClassNameId()),
1473
1474 journalArticleModelImpl.getOriginalTemplateId()
1475 };
1476
1477 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_T, args);
1478 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_T,
1479 args);
1480
1481 args = new Object[] {
1482 Long.valueOf(journalArticleModelImpl.getGroupId()),
1483 Long.valueOf(journalArticleModelImpl.getClassNameId()),
1484
1485 journalArticleModelImpl.getTemplateId()
1486 };
1487
1488 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_T, args);
1489 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_T,
1490 args);
1491 }
1492
1493 if ((journalArticleModelImpl.getColumnBitmask() &
1494 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_L.getColumnBitmask()) != 0) {
1495 Object[] args = new Object[] {
1496 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1497 Long.valueOf(journalArticleModelImpl.getOriginalClassNameId()),
1498
1499 journalArticleModelImpl.getOriginalLayoutUuid()
1500 };
1501
1502 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_L, args);
1503 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_L,
1504 args);
1505
1506 args = new Object[] {
1507 Long.valueOf(journalArticleModelImpl.getGroupId()),
1508 Long.valueOf(journalArticleModelImpl.getClassNameId()),
1509
1510 journalArticleModelImpl.getLayoutUuid()
1511 };
1512
1513 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_L, args);
1514 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_L,
1515 args);
1516 }
1517
1518 if ((journalArticleModelImpl.getColumnBitmask() &
1519 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_ST.getColumnBitmask()) != 0) {
1520 Object[] args = new Object[] {
1521 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1522
1523 journalArticleModelImpl.getOriginalArticleId(),
1524 Integer.valueOf(journalArticleModelImpl.getOriginalStatus())
1525 };
1526
1527 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_ST, args);
1528 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_ST,
1529 args);
1530
1531 args = new Object[] {
1532 Long.valueOf(journalArticleModelImpl.getGroupId()),
1533
1534 journalArticleModelImpl.getArticleId(),
1535 Integer.valueOf(journalArticleModelImpl.getStatus())
1536 };
1537
1538 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_ST, args);
1539 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_ST,
1540 args);
1541 }
1542
1543 if ((journalArticleModelImpl.getColumnBitmask() &
1544 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT_ST.getColumnBitmask()) != 0) {
1545 Object[] args = new Object[] {
1546 Long.valueOf(journalArticleModelImpl.getOriginalGroupId()),
1547
1548 journalArticleModelImpl.getOriginalUrlTitle(),
1549 Integer.valueOf(journalArticleModelImpl.getOriginalStatus())
1550 };
1551
1552 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_UT_ST, args);
1553 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT_ST,
1554 args);
1555
1556 args = new Object[] {
1557 Long.valueOf(journalArticleModelImpl.getGroupId()),
1558
1559 journalArticleModelImpl.getUrlTitle(),
1560 Integer.valueOf(journalArticleModelImpl.getStatus())
1561 };
1562
1563 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_UT_ST, args);
1564 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT_ST,
1565 args);
1566 }
1567
1568 if ((journalArticleModelImpl.getColumnBitmask() &
1569 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V_ST.getColumnBitmask()) != 0) {
1570 Object[] args = new Object[] {
1571 Long.valueOf(journalArticleModelImpl.getOriginalCompanyId()),
1572 Double.valueOf(journalArticleModelImpl.getOriginalVersion()),
1573 Integer.valueOf(journalArticleModelImpl.getOriginalStatus())
1574 };
1575
1576 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_V_ST, args);
1577 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V_ST,
1578 args);
1579
1580 args = new Object[] {
1581 Long.valueOf(journalArticleModelImpl.getCompanyId()),
1582 Double.valueOf(journalArticleModelImpl.getVersion()),
1583 Integer.valueOf(journalArticleModelImpl.getStatus())
1584 };
1585
1586 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_V_ST, args);
1587 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V_ST,
1588 args);
1589 }
1590 }
1591
1592 EntityCacheUtil.putResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
1593 JournalArticleImpl.class, journalArticle.getPrimaryKey(),
1594 journalArticle);
1595
1596 clearUniqueFindersCache(journalArticle);
1597 cacheUniqueFindersCache(journalArticle);
1598
1599 return journalArticle;
1600 }
1601
1602 protected JournalArticle toUnwrappedModel(JournalArticle journalArticle) {
1603 if (journalArticle instanceof JournalArticleImpl) {
1604 return journalArticle;
1605 }
1606
1607 JournalArticleImpl journalArticleImpl = new JournalArticleImpl();
1608
1609 journalArticleImpl.setNew(journalArticle.isNew());
1610 journalArticleImpl.setPrimaryKey(journalArticle.getPrimaryKey());
1611
1612 journalArticleImpl.setUuid(journalArticle.getUuid());
1613 journalArticleImpl.setId(journalArticle.getId());
1614 journalArticleImpl.setResourcePrimKey(journalArticle.getResourcePrimKey());
1615 journalArticleImpl.setGroupId(journalArticle.getGroupId());
1616 journalArticleImpl.setCompanyId(journalArticle.getCompanyId());
1617 journalArticleImpl.setUserId(journalArticle.getUserId());
1618 journalArticleImpl.setUserName(journalArticle.getUserName());
1619 journalArticleImpl.setCreateDate(journalArticle.getCreateDate());
1620 journalArticleImpl.setModifiedDate(journalArticle.getModifiedDate());
1621 journalArticleImpl.setClassNameId(journalArticle.getClassNameId());
1622 journalArticleImpl.setClassPK(journalArticle.getClassPK());
1623 journalArticleImpl.setArticleId(journalArticle.getArticleId());
1624 journalArticleImpl.setVersion(journalArticle.getVersion());
1625 journalArticleImpl.setTitle(journalArticle.getTitle());
1626 journalArticleImpl.setUrlTitle(journalArticle.getUrlTitle());
1627 journalArticleImpl.setDescription(journalArticle.getDescription());
1628 journalArticleImpl.setContent(journalArticle.getContent());
1629 journalArticleImpl.setType(journalArticle.getType());
1630 journalArticleImpl.setStructureId(journalArticle.getStructureId());
1631 journalArticleImpl.setTemplateId(journalArticle.getTemplateId());
1632 journalArticleImpl.setLayoutUuid(journalArticle.getLayoutUuid());
1633 journalArticleImpl.setDisplayDate(journalArticle.getDisplayDate());
1634 journalArticleImpl.setExpirationDate(journalArticle.getExpirationDate());
1635 journalArticleImpl.setReviewDate(journalArticle.getReviewDate());
1636 journalArticleImpl.setIndexable(journalArticle.isIndexable());
1637 journalArticleImpl.setSmallImage(journalArticle.isSmallImage());
1638 journalArticleImpl.setSmallImageId(journalArticle.getSmallImageId());
1639 journalArticleImpl.setSmallImageURL(journalArticle.getSmallImageURL());
1640 journalArticleImpl.setStatus(journalArticle.getStatus());
1641 journalArticleImpl.setStatusByUserId(journalArticle.getStatusByUserId());
1642 journalArticleImpl.setStatusByUserName(journalArticle.getStatusByUserName());
1643 journalArticleImpl.setStatusDate(journalArticle.getStatusDate());
1644
1645 return journalArticleImpl;
1646 }
1647
1648
1656 @Override
1657 public JournalArticle findByPrimaryKey(Serializable primaryKey)
1658 throws NoSuchModelException, SystemException {
1659 return findByPrimaryKey(((Long)primaryKey).longValue());
1660 }
1661
1662
1670 public JournalArticle findByPrimaryKey(long id)
1671 throws NoSuchArticleException, SystemException {
1672 JournalArticle journalArticle = fetchByPrimaryKey(id);
1673
1674 if (journalArticle == null) {
1675 if (_log.isWarnEnabled()) {
1676 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
1677 }
1678
1679 throw new NoSuchArticleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1680 id);
1681 }
1682
1683 return journalArticle;
1684 }
1685
1686
1693 @Override
1694 public JournalArticle fetchByPrimaryKey(Serializable primaryKey)
1695 throws SystemException {
1696 return fetchByPrimaryKey(((Long)primaryKey).longValue());
1697 }
1698
1699
1706 public JournalArticle fetchByPrimaryKey(long id) throws SystemException {
1707 JournalArticle journalArticle = (JournalArticle)EntityCacheUtil.getResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
1708 JournalArticleImpl.class, id);
1709
1710 if (journalArticle == _nullJournalArticle) {
1711 return null;
1712 }
1713
1714 if (journalArticle == null) {
1715 Session session = null;
1716
1717 boolean hasException = false;
1718
1719 try {
1720 session = openSession();
1721
1722 journalArticle = (JournalArticle)session.get(JournalArticleImpl.class,
1723 Long.valueOf(id));
1724 }
1725 catch (Exception e) {
1726 hasException = true;
1727
1728 throw processException(e);
1729 }
1730 finally {
1731 if (journalArticle != null) {
1732 cacheResult(journalArticle);
1733 }
1734 else if (!hasException) {
1735 EntityCacheUtil.putResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
1736 JournalArticleImpl.class, id, _nullJournalArticle);
1737 }
1738
1739 closeSession(session);
1740 }
1741 }
1742
1743 return journalArticle;
1744 }
1745
1746
1753 public List<JournalArticle> findByUuid(String uuid)
1754 throws SystemException {
1755 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1756 }
1757
1758
1771 public List<JournalArticle> findByUuid(String uuid, int start, int end)
1772 throws SystemException {
1773 return findByUuid(uuid, start, end, null);
1774 }
1775
1776
1790 public List<JournalArticle> findByUuid(String uuid, int start, int end,
1791 OrderByComparator orderByComparator) throws SystemException {
1792 FinderPath finderPath = null;
1793 Object[] finderArgs = null;
1794
1795 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1796 (orderByComparator == null)) {
1797 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
1798 finderArgs = new Object[] { uuid };
1799 }
1800 else {
1801 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
1802 finderArgs = new Object[] { uuid, start, end, orderByComparator };
1803 }
1804
1805 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
1806 finderArgs, this);
1807
1808 if ((list != null) && !list.isEmpty()) {
1809 for (JournalArticle journalArticle : list) {
1810 if (!Validator.equals(uuid, journalArticle.getUuid())) {
1811 list = null;
1812
1813 break;
1814 }
1815 }
1816 }
1817
1818 if (list == null) {
1819 StringBundler query = null;
1820
1821 if (orderByComparator != null) {
1822 query = new StringBundler(3 +
1823 (orderByComparator.getOrderByFields().length * 3));
1824 }
1825 else {
1826 query = new StringBundler(3);
1827 }
1828
1829 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1830
1831 if (uuid == null) {
1832 query.append(_FINDER_COLUMN_UUID_UUID_1);
1833 }
1834 else {
1835 if (uuid.equals(StringPool.BLANK)) {
1836 query.append(_FINDER_COLUMN_UUID_UUID_3);
1837 }
1838 else {
1839 query.append(_FINDER_COLUMN_UUID_UUID_2);
1840 }
1841 }
1842
1843 if (orderByComparator != null) {
1844 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1845 orderByComparator);
1846 }
1847
1848 else {
1849 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1850 }
1851
1852 String sql = query.toString();
1853
1854 Session session = null;
1855
1856 try {
1857 session = openSession();
1858
1859 Query q = session.createQuery(sql);
1860
1861 QueryPos qPos = QueryPos.getInstance(q);
1862
1863 if (uuid != null) {
1864 qPos.add(uuid);
1865 }
1866
1867 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
1868 start, end);
1869 }
1870 catch (Exception e) {
1871 throw processException(e);
1872 }
1873 finally {
1874 if (list == null) {
1875 FinderCacheUtil.removeResult(finderPath, finderArgs);
1876 }
1877 else {
1878 cacheResult(list);
1879
1880 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1881 }
1882
1883 closeSession(session);
1884 }
1885 }
1886
1887 return list;
1888 }
1889
1890
1899 public JournalArticle findByUuid_First(String uuid,
1900 OrderByComparator orderByComparator)
1901 throws NoSuchArticleException, SystemException {
1902 JournalArticle journalArticle = fetchByUuid_First(uuid,
1903 orderByComparator);
1904
1905 if (journalArticle != null) {
1906 return journalArticle;
1907 }
1908
1909 StringBundler msg = new StringBundler(4);
1910
1911 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1912
1913 msg.append("uuid=");
1914 msg.append(uuid);
1915
1916 msg.append(StringPool.CLOSE_CURLY_BRACE);
1917
1918 throw new NoSuchArticleException(msg.toString());
1919 }
1920
1921
1929 public JournalArticle fetchByUuid_First(String uuid,
1930 OrderByComparator orderByComparator) throws SystemException {
1931 List<JournalArticle> list = findByUuid(uuid, 0, 1, orderByComparator);
1932
1933 if (!list.isEmpty()) {
1934 return list.get(0);
1935 }
1936
1937 return null;
1938 }
1939
1940
1949 public JournalArticle findByUuid_Last(String uuid,
1950 OrderByComparator orderByComparator)
1951 throws NoSuchArticleException, SystemException {
1952 JournalArticle journalArticle = fetchByUuid_Last(uuid, orderByComparator);
1953
1954 if (journalArticle != null) {
1955 return journalArticle;
1956 }
1957
1958 StringBundler msg = new StringBundler(4);
1959
1960 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1961
1962 msg.append("uuid=");
1963 msg.append(uuid);
1964
1965 msg.append(StringPool.CLOSE_CURLY_BRACE);
1966
1967 throw new NoSuchArticleException(msg.toString());
1968 }
1969
1970
1978 public JournalArticle fetchByUuid_Last(String uuid,
1979 OrderByComparator orderByComparator) throws SystemException {
1980 int count = countByUuid(uuid);
1981
1982 List<JournalArticle> list = findByUuid(uuid, count - 1, count,
1983 orderByComparator);
1984
1985 if (!list.isEmpty()) {
1986 return list.get(0);
1987 }
1988
1989 return null;
1990 }
1991
1992
2002 public JournalArticle[] findByUuid_PrevAndNext(long id, String uuid,
2003 OrderByComparator orderByComparator)
2004 throws NoSuchArticleException, SystemException {
2005 JournalArticle journalArticle = findByPrimaryKey(id);
2006
2007 Session session = null;
2008
2009 try {
2010 session = openSession();
2011
2012 JournalArticle[] array = new JournalArticleImpl[3];
2013
2014 array[0] = getByUuid_PrevAndNext(session, journalArticle, uuid,
2015 orderByComparator, true);
2016
2017 array[1] = journalArticle;
2018
2019 array[2] = getByUuid_PrevAndNext(session, journalArticle, uuid,
2020 orderByComparator, false);
2021
2022 return array;
2023 }
2024 catch (Exception e) {
2025 throw processException(e);
2026 }
2027 finally {
2028 closeSession(session);
2029 }
2030 }
2031
2032 protected JournalArticle getByUuid_PrevAndNext(Session session,
2033 JournalArticle journalArticle, String uuid,
2034 OrderByComparator orderByComparator, boolean previous) {
2035 StringBundler query = null;
2036
2037 if (orderByComparator != null) {
2038 query = new StringBundler(6 +
2039 (orderByComparator.getOrderByFields().length * 6));
2040 }
2041 else {
2042 query = new StringBundler(3);
2043 }
2044
2045 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2046
2047 if (uuid == null) {
2048 query.append(_FINDER_COLUMN_UUID_UUID_1);
2049 }
2050 else {
2051 if (uuid.equals(StringPool.BLANK)) {
2052 query.append(_FINDER_COLUMN_UUID_UUID_3);
2053 }
2054 else {
2055 query.append(_FINDER_COLUMN_UUID_UUID_2);
2056 }
2057 }
2058
2059 if (orderByComparator != null) {
2060 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2061
2062 if (orderByConditionFields.length > 0) {
2063 query.append(WHERE_AND);
2064 }
2065
2066 for (int i = 0; i < orderByConditionFields.length; i++) {
2067 query.append(_ORDER_BY_ENTITY_ALIAS);
2068 query.append(orderByConditionFields[i]);
2069
2070 if ((i + 1) < orderByConditionFields.length) {
2071 if (orderByComparator.isAscending() ^ previous) {
2072 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2073 }
2074 else {
2075 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2076 }
2077 }
2078 else {
2079 if (orderByComparator.isAscending() ^ previous) {
2080 query.append(WHERE_GREATER_THAN);
2081 }
2082 else {
2083 query.append(WHERE_LESSER_THAN);
2084 }
2085 }
2086 }
2087
2088 query.append(ORDER_BY_CLAUSE);
2089
2090 String[] orderByFields = orderByComparator.getOrderByFields();
2091
2092 for (int i = 0; i < orderByFields.length; i++) {
2093 query.append(_ORDER_BY_ENTITY_ALIAS);
2094 query.append(orderByFields[i]);
2095
2096 if ((i + 1) < orderByFields.length) {
2097 if (orderByComparator.isAscending() ^ previous) {
2098 query.append(ORDER_BY_ASC_HAS_NEXT);
2099 }
2100 else {
2101 query.append(ORDER_BY_DESC_HAS_NEXT);
2102 }
2103 }
2104 else {
2105 if (orderByComparator.isAscending() ^ previous) {
2106 query.append(ORDER_BY_ASC);
2107 }
2108 else {
2109 query.append(ORDER_BY_DESC);
2110 }
2111 }
2112 }
2113 }
2114
2115 else {
2116 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2117 }
2118
2119 String sql = query.toString();
2120
2121 Query q = session.createQuery(sql);
2122
2123 q.setFirstResult(0);
2124 q.setMaxResults(2);
2125
2126 QueryPos qPos = QueryPos.getInstance(q);
2127
2128 if (uuid != null) {
2129 qPos.add(uuid);
2130 }
2131
2132 if (orderByComparator != null) {
2133 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
2134
2135 for (Object value : values) {
2136 qPos.add(value);
2137 }
2138 }
2139
2140 List<JournalArticle> list = q.list();
2141
2142 if (list.size() == 2) {
2143 return list.get(1);
2144 }
2145 else {
2146 return null;
2147 }
2148 }
2149
2150
2159 public JournalArticle findByUUID_G(String uuid, long groupId)
2160 throws NoSuchArticleException, SystemException {
2161 JournalArticle journalArticle = fetchByUUID_G(uuid, groupId);
2162
2163 if (journalArticle == null) {
2164 StringBundler msg = new StringBundler(6);
2165
2166 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2167
2168 msg.append("uuid=");
2169 msg.append(uuid);
2170
2171 msg.append(", groupId=");
2172 msg.append(groupId);
2173
2174 msg.append(StringPool.CLOSE_CURLY_BRACE);
2175
2176 if (_log.isWarnEnabled()) {
2177 _log.warn(msg.toString());
2178 }
2179
2180 throw new NoSuchArticleException(msg.toString());
2181 }
2182
2183 return journalArticle;
2184 }
2185
2186
2194 public JournalArticle fetchByUUID_G(String uuid, long groupId)
2195 throws SystemException {
2196 return fetchByUUID_G(uuid, groupId, true);
2197 }
2198
2199
2208 public JournalArticle fetchByUUID_G(String uuid, long groupId,
2209 boolean retrieveFromCache) throws SystemException {
2210 Object[] finderArgs = new Object[] { uuid, groupId };
2211
2212 Object result = null;
2213
2214 if (retrieveFromCache) {
2215 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
2216 finderArgs, this);
2217 }
2218
2219 if (result instanceof JournalArticle) {
2220 JournalArticle journalArticle = (JournalArticle)result;
2221
2222 if (!Validator.equals(uuid, journalArticle.getUuid()) ||
2223 (groupId != journalArticle.getGroupId())) {
2224 result = null;
2225 }
2226 }
2227
2228 if (result == null) {
2229 StringBundler query = new StringBundler(4);
2230
2231 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2232
2233 if (uuid == null) {
2234 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2235 }
2236 else {
2237 if (uuid.equals(StringPool.BLANK)) {
2238 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2239 }
2240 else {
2241 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2242 }
2243 }
2244
2245 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2246
2247 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2248
2249 String sql = query.toString();
2250
2251 Session session = null;
2252
2253 try {
2254 session = openSession();
2255
2256 Query q = session.createQuery(sql);
2257
2258 QueryPos qPos = QueryPos.getInstance(q);
2259
2260 if (uuid != null) {
2261 qPos.add(uuid);
2262 }
2263
2264 qPos.add(groupId);
2265
2266 List<JournalArticle> list = q.list();
2267
2268 result = list;
2269
2270 JournalArticle journalArticle = null;
2271
2272 if (list.isEmpty()) {
2273 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
2274 finderArgs, list);
2275 }
2276 else {
2277 journalArticle = list.get(0);
2278
2279 cacheResult(journalArticle);
2280
2281 if ((journalArticle.getUuid() == null) ||
2282 !journalArticle.getUuid().equals(uuid) ||
2283 (journalArticle.getGroupId() != groupId)) {
2284 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
2285 finderArgs, journalArticle);
2286 }
2287 }
2288
2289 return journalArticle;
2290 }
2291 catch (Exception e) {
2292 throw processException(e);
2293 }
2294 finally {
2295 if (result == null) {
2296 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
2297 finderArgs);
2298 }
2299
2300 closeSession(session);
2301 }
2302 }
2303 else {
2304 if (result instanceof List<?>) {
2305 return null;
2306 }
2307 else {
2308 return (JournalArticle)result;
2309 }
2310 }
2311 }
2312
2313
2320 public List<JournalArticle> findByResourcePrimKey(long resourcePrimKey)
2321 throws SystemException {
2322 return findByResourcePrimKey(resourcePrimKey, QueryUtil.ALL_POS,
2323 QueryUtil.ALL_POS, null);
2324 }
2325
2326
2339 public List<JournalArticle> findByResourcePrimKey(long resourcePrimKey,
2340 int start, int end) throws SystemException {
2341 return findByResourcePrimKey(resourcePrimKey, start, end, null);
2342 }
2343
2344
2358 public List<JournalArticle> findByResourcePrimKey(long resourcePrimKey,
2359 int start, int end, OrderByComparator orderByComparator)
2360 throws SystemException {
2361 FinderPath finderPath = null;
2362 Object[] finderArgs = null;
2363
2364 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2365 (orderByComparator == null)) {
2366 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESOURCEPRIMKEY;
2367 finderArgs = new Object[] { resourcePrimKey };
2368 }
2369 else {
2370 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_RESOURCEPRIMKEY;
2371 finderArgs = new Object[] {
2372 resourcePrimKey,
2373
2374 start, end, orderByComparator
2375 };
2376 }
2377
2378 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
2379 finderArgs, this);
2380
2381 if ((list != null) && !list.isEmpty()) {
2382 for (JournalArticle journalArticle : list) {
2383 if ((resourcePrimKey != journalArticle.getResourcePrimKey())) {
2384 list = null;
2385
2386 break;
2387 }
2388 }
2389 }
2390
2391 if (list == null) {
2392 StringBundler query = null;
2393
2394 if (orderByComparator != null) {
2395 query = new StringBundler(3 +
2396 (orderByComparator.getOrderByFields().length * 3));
2397 }
2398 else {
2399 query = new StringBundler(3);
2400 }
2401
2402 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2403
2404 query.append(_FINDER_COLUMN_RESOURCEPRIMKEY_RESOURCEPRIMKEY_2);
2405
2406 if (orderByComparator != null) {
2407 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2408 orderByComparator);
2409 }
2410
2411 else {
2412 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2413 }
2414
2415 String sql = query.toString();
2416
2417 Session session = null;
2418
2419 try {
2420 session = openSession();
2421
2422 Query q = session.createQuery(sql);
2423
2424 QueryPos qPos = QueryPos.getInstance(q);
2425
2426 qPos.add(resourcePrimKey);
2427
2428 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
2429 start, end);
2430 }
2431 catch (Exception e) {
2432 throw processException(e);
2433 }
2434 finally {
2435 if (list == null) {
2436 FinderCacheUtil.removeResult(finderPath, finderArgs);
2437 }
2438 else {
2439 cacheResult(list);
2440
2441 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2442 }
2443
2444 closeSession(session);
2445 }
2446 }
2447
2448 return list;
2449 }
2450
2451
2460 public JournalArticle findByResourcePrimKey_First(long resourcePrimKey,
2461 OrderByComparator orderByComparator)
2462 throws NoSuchArticleException, SystemException {
2463 JournalArticle journalArticle = fetchByResourcePrimKey_First(resourcePrimKey,
2464 orderByComparator);
2465
2466 if (journalArticle != null) {
2467 return journalArticle;
2468 }
2469
2470 StringBundler msg = new StringBundler(4);
2471
2472 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2473
2474 msg.append("resourcePrimKey=");
2475 msg.append(resourcePrimKey);
2476
2477 msg.append(StringPool.CLOSE_CURLY_BRACE);
2478
2479 throw new NoSuchArticleException(msg.toString());
2480 }
2481
2482
2490 public JournalArticle fetchByResourcePrimKey_First(long resourcePrimKey,
2491 OrderByComparator orderByComparator) throws SystemException {
2492 List<JournalArticle> list = findByResourcePrimKey(resourcePrimKey, 0,
2493 1, orderByComparator);
2494
2495 if (!list.isEmpty()) {
2496 return list.get(0);
2497 }
2498
2499 return null;
2500 }
2501
2502
2511 public JournalArticle findByResourcePrimKey_Last(long resourcePrimKey,
2512 OrderByComparator orderByComparator)
2513 throws NoSuchArticleException, SystemException {
2514 JournalArticle journalArticle = fetchByResourcePrimKey_Last(resourcePrimKey,
2515 orderByComparator);
2516
2517 if (journalArticle != null) {
2518 return journalArticle;
2519 }
2520
2521 StringBundler msg = new StringBundler(4);
2522
2523 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2524
2525 msg.append("resourcePrimKey=");
2526 msg.append(resourcePrimKey);
2527
2528 msg.append(StringPool.CLOSE_CURLY_BRACE);
2529
2530 throw new NoSuchArticleException(msg.toString());
2531 }
2532
2533
2541 public JournalArticle fetchByResourcePrimKey_Last(long resourcePrimKey,
2542 OrderByComparator orderByComparator) throws SystemException {
2543 int count = countByResourcePrimKey(resourcePrimKey);
2544
2545 List<JournalArticle> list = findByResourcePrimKey(resourcePrimKey,
2546 count - 1, count, orderByComparator);
2547
2548 if (!list.isEmpty()) {
2549 return list.get(0);
2550 }
2551
2552 return null;
2553 }
2554
2555
2565 public JournalArticle[] findByResourcePrimKey_PrevAndNext(long id,
2566 long resourcePrimKey, OrderByComparator orderByComparator)
2567 throws NoSuchArticleException, SystemException {
2568 JournalArticle journalArticle = findByPrimaryKey(id);
2569
2570 Session session = null;
2571
2572 try {
2573 session = openSession();
2574
2575 JournalArticle[] array = new JournalArticleImpl[3];
2576
2577 array[0] = getByResourcePrimKey_PrevAndNext(session,
2578 journalArticle, resourcePrimKey, orderByComparator, true);
2579
2580 array[1] = journalArticle;
2581
2582 array[2] = getByResourcePrimKey_PrevAndNext(session,
2583 journalArticle, resourcePrimKey, orderByComparator, false);
2584
2585 return array;
2586 }
2587 catch (Exception e) {
2588 throw processException(e);
2589 }
2590 finally {
2591 closeSession(session);
2592 }
2593 }
2594
2595 protected JournalArticle getByResourcePrimKey_PrevAndNext(Session session,
2596 JournalArticle journalArticle, long resourcePrimKey,
2597 OrderByComparator orderByComparator, boolean previous) {
2598 StringBundler query = null;
2599
2600 if (orderByComparator != null) {
2601 query = new StringBundler(6 +
2602 (orderByComparator.getOrderByFields().length * 6));
2603 }
2604 else {
2605 query = new StringBundler(3);
2606 }
2607
2608 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2609
2610 query.append(_FINDER_COLUMN_RESOURCEPRIMKEY_RESOURCEPRIMKEY_2);
2611
2612 if (orderByComparator != null) {
2613 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2614
2615 if (orderByConditionFields.length > 0) {
2616 query.append(WHERE_AND);
2617 }
2618
2619 for (int i = 0; i < orderByConditionFields.length; i++) {
2620 query.append(_ORDER_BY_ENTITY_ALIAS);
2621 query.append(orderByConditionFields[i]);
2622
2623 if ((i + 1) < orderByConditionFields.length) {
2624 if (orderByComparator.isAscending() ^ previous) {
2625 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2626 }
2627 else {
2628 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2629 }
2630 }
2631 else {
2632 if (orderByComparator.isAscending() ^ previous) {
2633 query.append(WHERE_GREATER_THAN);
2634 }
2635 else {
2636 query.append(WHERE_LESSER_THAN);
2637 }
2638 }
2639 }
2640
2641 query.append(ORDER_BY_CLAUSE);
2642
2643 String[] orderByFields = orderByComparator.getOrderByFields();
2644
2645 for (int i = 0; i < orderByFields.length; i++) {
2646 query.append(_ORDER_BY_ENTITY_ALIAS);
2647 query.append(orderByFields[i]);
2648
2649 if ((i + 1) < orderByFields.length) {
2650 if (orderByComparator.isAscending() ^ previous) {
2651 query.append(ORDER_BY_ASC_HAS_NEXT);
2652 }
2653 else {
2654 query.append(ORDER_BY_DESC_HAS_NEXT);
2655 }
2656 }
2657 else {
2658 if (orderByComparator.isAscending() ^ previous) {
2659 query.append(ORDER_BY_ASC);
2660 }
2661 else {
2662 query.append(ORDER_BY_DESC);
2663 }
2664 }
2665 }
2666 }
2667
2668 else {
2669 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2670 }
2671
2672 String sql = query.toString();
2673
2674 Query q = session.createQuery(sql);
2675
2676 q.setFirstResult(0);
2677 q.setMaxResults(2);
2678
2679 QueryPos qPos = QueryPos.getInstance(q);
2680
2681 qPos.add(resourcePrimKey);
2682
2683 if (orderByComparator != null) {
2684 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
2685
2686 for (Object value : values) {
2687 qPos.add(value);
2688 }
2689 }
2690
2691 List<JournalArticle> list = q.list();
2692
2693 if (list.size() == 2) {
2694 return list.get(1);
2695 }
2696 else {
2697 return null;
2698 }
2699 }
2700
2701
2708 public List<JournalArticle> findByGroupId(long groupId)
2709 throws SystemException {
2710 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2711 }
2712
2713
2726 public List<JournalArticle> findByGroupId(long groupId, int start, int end)
2727 throws SystemException {
2728 return findByGroupId(groupId, start, end, null);
2729 }
2730
2731
2745 public List<JournalArticle> findByGroupId(long groupId, int start, int end,
2746 OrderByComparator orderByComparator) throws SystemException {
2747 FinderPath finderPath = null;
2748 Object[] finderArgs = null;
2749
2750 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2751 (orderByComparator == null)) {
2752 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
2753 finderArgs = new Object[] { groupId };
2754 }
2755 else {
2756 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
2757 finderArgs = new Object[] { groupId, start, end, orderByComparator };
2758 }
2759
2760 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
2761 finderArgs, this);
2762
2763 if ((list != null) && !list.isEmpty()) {
2764 for (JournalArticle journalArticle : list) {
2765 if ((groupId != journalArticle.getGroupId())) {
2766 list = null;
2767
2768 break;
2769 }
2770 }
2771 }
2772
2773 if (list == null) {
2774 StringBundler query = null;
2775
2776 if (orderByComparator != null) {
2777 query = new StringBundler(3 +
2778 (orderByComparator.getOrderByFields().length * 3));
2779 }
2780 else {
2781 query = new StringBundler(3);
2782 }
2783
2784 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2785
2786 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2787
2788 if (orderByComparator != null) {
2789 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2790 orderByComparator);
2791 }
2792
2793 else {
2794 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2795 }
2796
2797 String sql = query.toString();
2798
2799 Session session = null;
2800
2801 try {
2802 session = openSession();
2803
2804 Query q = session.createQuery(sql);
2805
2806 QueryPos qPos = QueryPos.getInstance(q);
2807
2808 qPos.add(groupId);
2809
2810 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
2811 start, end);
2812 }
2813 catch (Exception e) {
2814 throw processException(e);
2815 }
2816 finally {
2817 if (list == null) {
2818 FinderCacheUtil.removeResult(finderPath, finderArgs);
2819 }
2820 else {
2821 cacheResult(list);
2822
2823 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2824 }
2825
2826 closeSession(session);
2827 }
2828 }
2829
2830 return list;
2831 }
2832
2833
2842 public JournalArticle findByGroupId_First(long groupId,
2843 OrderByComparator orderByComparator)
2844 throws NoSuchArticleException, SystemException {
2845 JournalArticle journalArticle = fetchByGroupId_First(groupId,
2846 orderByComparator);
2847
2848 if (journalArticle != null) {
2849 return journalArticle;
2850 }
2851
2852 StringBundler msg = new StringBundler(4);
2853
2854 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2855
2856 msg.append("groupId=");
2857 msg.append(groupId);
2858
2859 msg.append(StringPool.CLOSE_CURLY_BRACE);
2860
2861 throw new NoSuchArticleException(msg.toString());
2862 }
2863
2864
2872 public JournalArticle fetchByGroupId_First(long groupId,
2873 OrderByComparator orderByComparator) throws SystemException {
2874 List<JournalArticle> list = findByGroupId(groupId, 0, 1,
2875 orderByComparator);
2876
2877 if (!list.isEmpty()) {
2878 return list.get(0);
2879 }
2880
2881 return null;
2882 }
2883
2884
2893 public JournalArticle findByGroupId_Last(long groupId,
2894 OrderByComparator orderByComparator)
2895 throws NoSuchArticleException, SystemException {
2896 JournalArticle journalArticle = fetchByGroupId_Last(groupId,
2897 orderByComparator);
2898
2899 if (journalArticle != null) {
2900 return journalArticle;
2901 }
2902
2903 StringBundler msg = new StringBundler(4);
2904
2905 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2906
2907 msg.append("groupId=");
2908 msg.append(groupId);
2909
2910 msg.append(StringPool.CLOSE_CURLY_BRACE);
2911
2912 throw new NoSuchArticleException(msg.toString());
2913 }
2914
2915
2923 public JournalArticle fetchByGroupId_Last(long groupId,
2924 OrderByComparator orderByComparator) throws SystemException {
2925 int count = countByGroupId(groupId);
2926
2927 List<JournalArticle> list = findByGroupId(groupId, count - 1, count,
2928 orderByComparator);
2929
2930 if (!list.isEmpty()) {
2931 return list.get(0);
2932 }
2933
2934 return null;
2935 }
2936
2937
2947 public JournalArticle[] findByGroupId_PrevAndNext(long id, long groupId,
2948 OrderByComparator orderByComparator)
2949 throws NoSuchArticleException, SystemException {
2950 JournalArticle journalArticle = findByPrimaryKey(id);
2951
2952 Session session = null;
2953
2954 try {
2955 session = openSession();
2956
2957 JournalArticle[] array = new JournalArticleImpl[3];
2958
2959 array[0] = getByGroupId_PrevAndNext(session, journalArticle,
2960 groupId, orderByComparator, true);
2961
2962 array[1] = journalArticle;
2963
2964 array[2] = getByGroupId_PrevAndNext(session, journalArticle,
2965 groupId, orderByComparator, false);
2966
2967 return array;
2968 }
2969 catch (Exception e) {
2970 throw processException(e);
2971 }
2972 finally {
2973 closeSession(session);
2974 }
2975 }
2976
2977 protected JournalArticle getByGroupId_PrevAndNext(Session session,
2978 JournalArticle journalArticle, long groupId,
2979 OrderByComparator orderByComparator, boolean previous) {
2980 StringBundler query = null;
2981
2982 if (orderByComparator != null) {
2983 query = new StringBundler(6 +
2984 (orderByComparator.getOrderByFields().length * 6));
2985 }
2986 else {
2987 query = new StringBundler(3);
2988 }
2989
2990 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2991
2992 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2993
2994 if (orderByComparator != null) {
2995 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2996
2997 if (orderByConditionFields.length > 0) {
2998 query.append(WHERE_AND);
2999 }
3000
3001 for (int i = 0; i < orderByConditionFields.length; i++) {
3002 query.append(_ORDER_BY_ENTITY_ALIAS);
3003 query.append(orderByConditionFields[i]);
3004
3005 if ((i + 1) < orderByConditionFields.length) {
3006 if (orderByComparator.isAscending() ^ previous) {
3007 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3008 }
3009 else {
3010 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3011 }
3012 }
3013 else {
3014 if (orderByComparator.isAscending() ^ previous) {
3015 query.append(WHERE_GREATER_THAN);
3016 }
3017 else {
3018 query.append(WHERE_LESSER_THAN);
3019 }
3020 }
3021 }
3022
3023 query.append(ORDER_BY_CLAUSE);
3024
3025 String[] orderByFields = orderByComparator.getOrderByFields();
3026
3027 for (int i = 0; i < orderByFields.length; i++) {
3028 query.append(_ORDER_BY_ENTITY_ALIAS);
3029 query.append(orderByFields[i]);
3030
3031 if ((i + 1) < orderByFields.length) {
3032 if (orderByComparator.isAscending() ^ previous) {
3033 query.append(ORDER_BY_ASC_HAS_NEXT);
3034 }
3035 else {
3036 query.append(ORDER_BY_DESC_HAS_NEXT);
3037 }
3038 }
3039 else {
3040 if (orderByComparator.isAscending() ^ previous) {
3041 query.append(ORDER_BY_ASC);
3042 }
3043 else {
3044 query.append(ORDER_BY_DESC);
3045 }
3046 }
3047 }
3048 }
3049
3050 else {
3051 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3052 }
3053
3054 String sql = query.toString();
3055
3056 Query q = session.createQuery(sql);
3057
3058 q.setFirstResult(0);
3059 q.setMaxResults(2);
3060
3061 QueryPos qPos = QueryPos.getInstance(q);
3062
3063 qPos.add(groupId);
3064
3065 if (orderByComparator != null) {
3066 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
3067
3068 for (Object value : values) {
3069 qPos.add(value);
3070 }
3071 }
3072
3073 List<JournalArticle> list = q.list();
3074
3075 if (list.size() == 2) {
3076 return list.get(1);
3077 }
3078 else {
3079 return null;
3080 }
3081 }
3082
3083
3090 public List<JournalArticle> filterFindByGroupId(long groupId)
3091 throws SystemException {
3092 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
3093 QueryUtil.ALL_POS, null);
3094 }
3095
3096
3109 public List<JournalArticle> filterFindByGroupId(long groupId, int start,
3110 int end) throws SystemException {
3111 return filterFindByGroupId(groupId, start, end, null);
3112 }
3113
3114
3128 public List<JournalArticle> filterFindByGroupId(long groupId, int start,
3129 int end, OrderByComparator orderByComparator) throws SystemException {
3130 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3131 return findByGroupId(groupId, start, end, orderByComparator);
3132 }
3133
3134 StringBundler query = null;
3135
3136 if (orderByComparator != null) {
3137 query = new StringBundler(3 +
3138 (orderByComparator.getOrderByFields().length * 3));
3139 }
3140 else {
3141 query = new StringBundler(3);
3142 }
3143
3144 if (getDB().isSupportsInlineDistinct()) {
3145 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
3146 }
3147 else {
3148 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
3149 }
3150
3151 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3152
3153 if (!getDB().isSupportsInlineDistinct()) {
3154 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
3155 }
3156
3157 if (orderByComparator != null) {
3158 if (getDB().isSupportsInlineDistinct()) {
3159 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3160 orderByComparator);
3161 }
3162 else {
3163 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
3164 orderByComparator);
3165 }
3166 }
3167
3168 else {
3169 if (getDB().isSupportsInlineDistinct()) {
3170 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3171 }
3172 else {
3173 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
3174 }
3175 }
3176
3177 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3178 JournalArticle.class.getName(),
3179 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3180
3181 Session session = null;
3182
3183 try {
3184 session = openSession();
3185
3186 SQLQuery q = session.createSQLQuery(sql);
3187
3188 if (getDB().isSupportsInlineDistinct()) {
3189 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
3190 }
3191 else {
3192 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
3193 }
3194
3195 QueryPos qPos = QueryPos.getInstance(q);
3196
3197 qPos.add(groupId);
3198
3199 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
3200 end);
3201 }
3202 catch (Exception e) {
3203 throw processException(e);
3204 }
3205 finally {
3206 closeSession(session);
3207 }
3208 }
3209
3210
3220 public JournalArticle[] filterFindByGroupId_PrevAndNext(long id,
3221 long groupId, OrderByComparator orderByComparator)
3222 throws NoSuchArticleException, SystemException {
3223 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3224 return findByGroupId_PrevAndNext(id, groupId, orderByComparator);
3225 }
3226
3227 JournalArticle journalArticle = findByPrimaryKey(id);
3228
3229 Session session = null;
3230
3231 try {
3232 session = openSession();
3233
3234 JournalArticle[] array = new JournalArticleImpl[3];
3235
3236 array[0] = filterGetByGroupId_PrevAndNext(session, journalArticle,
3237 groupId, orderByComparator, true);
3238
3239 array[1] = journalArticle;
3240
3241 array[2] = filterGetByGroupId_PrevAndNext(session, journalArticle,
3242 groupId, orderByComparator, false);
3243
3244 return array;
3245 }
3246 catch (Exception e) {
3247 throw processException(e);
3248 }
3249 finally {
3250 closeSession(session);
3251 }
3252 }
3253
3254 protected JournalArticle filterGetByGroupId_PrevAndNext(Session session,
3255 JournalArticle journalArticle, long groupId,
3256 OrderByComparator orderByComparator, boolean previous) {
3257 StringBundler query = null;
3258
3259 if (orderByComparator != null) {
3260 query = new StringBundler(6 +
3261 (orderByComparator.getOrderByFields().length * 6));
3262 }
3263 else {
3264 query = new StringBundler(3);
3265 }
3266
3267 if (getDB().isSupportsInlineDistinct()) {
3268 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
3269 }
3270 else {
3271 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
3272 }
3273
3274 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3275
3276 if (!getDB().isSupportsInlineDistinct()) {
3277 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
3278 }
3279
3280 if (orderByComparator != null) {
3281 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3282
3283 if (orderByConditionFields.length > 0) {
3284 query.append(WHERE_AND);
3285 }
3286
3287 for (int i = 0; i < orderByConditionFields.length; i++) {
3288 if (getDB().isSupportsInlineDistinct()) {
3289 query.append(_ORDER_BY_ENTITY_ALIAS);
3290 }
3291 else {
3292 query.append(_ORDER_BY_ENTITY_TABLE);
3293 }
3294
3295 query.append(orderByConditionFields[i]);
3296
3297 if ((i + 1) < orderByConditionFields.length) {
3298 if (orderByComparator.isAscending() ^ previous) {
3299 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3300 }
3301 else {
3302 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3303 }
3304 }
3305 else {
3306 if (orderByComparator.isAscending() ^ previous) {
3307 query.append(WHERE_GREATER_THAN);
3308 }
3309 else {
3310 query.append(WHERE_LESSER_THAN);
3311 }
3312 }
3313 }
3314
3315 query.append(ORDER_BY_CLAUSE);
3316
3317 String[] orderByFields = orderByComparator.getOrderByFields();
3318
3319 for (int i = 0; i < orderByFields.length; i++) {
3320 if (getDB().isSupportsInlineDistinct()) {
3321 query.append(_ORDER_BY_ENTITY_ALIAS);
3322 }
3323 else {
3324 query.append(_ORDER_BY_ENTITY_TABLE);
3325 }
3326
3327 query.append(orderByFields[i]);
3328
3329 if ((i + 1) < orderByFields.length) {
3330 if (orderByComparator.isAscending() ^ previous) {
3331 query.append(ORDER_BY_ASC_HAS_NEXT);
3332 }
3333 else {
3334 query.append(ORDER_BY_DESC_HAS_NEXT);
3335 }
3336 }
3337 else {
3338 if (orderByComparator.isAscending() ^ previous) {
3339 query.append(ORDER_BY_ASC);
3340 }
3341 else {
3342 query.append(ORDER_BY_DESC);
3343 }
3344 }
3345 }
3346 }
3347
3348 else {
3349 if (getDB().isSupportsInlineDistinct()) {
3350 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3351 }
3352 else {
3353 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
3354 }
3355 }
3356
3357 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3358 JournalArticle.class.getName(),
3359 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3360
3361 SQLQuery q = session.createSQLQuery(sql);
3362
3363 q.setFirstResult(0);
3364 q.setMaxResults(2);
3365
3366 if (getDB().isSupportsInlineDistinct()) {
3367 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
3368 }
3369 else {
3370 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
3371 }
3372
3373 QueryPos qPos = QueryPos.getInstance(q);
3374
3375 qPos.add(groupId);
3376
3377 if (orderByComparator != null) {
3378 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
3379
3380 for (Object value : values) {
3381 qPos.add(value);
3382 }
3383 }
3384
3385 List<JournalArticle> list = q.list();
3386
3387 if (list.size() == 2) {
3388 return list.get(1);
3389 }
3390 else {
3391 return null;
3392 }
3393 }
3394
3395
3402 public List<JournalArticle> findByCompanyId(long companyId)
3403 throws SystemException {
3404 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
3405 null);
3406 }
3407
3408
3421 public List<JournalArticle> findByCompanyId(long companyId, int start,
3422 int end) throws SystemException {
3423 return findByCompanyId(companyId, start, end, null);
3424 }
3425
3426
3440 public List<JournalArticle> findByCompanyId(long companyId, int start,
3441 int end, OrderByComparator orderByComparator) throws SystemException {
3442 FinderPath finderPath = null;
3443 Object[] finderArgs = null;
3444
3445 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3446 (orderByComparator == null)) {
3447 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
3448 finderArgs = new Object[] { companyId };
3449 }
3450 else {
3451 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
3452 finderArgs = new Object[] { companyId, start, end, orderByComparator };
3453 }
3454
3455 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
3456 finderArgs, this);
3457
3458 if ((list != null) && !list.isEmpty()) {
3459 for (JournalArticle journalArticle : list) {
3460 if ((companyId != journalArticle.getCompanyId())) {
3461 list = null;
3462
3463 break;
3464 }
3465 }
3466 }
3467
3468 if (list == null) {
3469 StringBundler query = null;
3470
3471 if (orderByComparator != null) {
3472 query = new StringBundler(3 +
3473 (orderByComparator.getOrderByFields().length * 3));
3474 }
3475 else {
3476 query = new StringBundler(3);
3477 }
3478
3479 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3480
3481 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3482
3483 if (orderByComparator != null) {
3484 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3485 orderByComparator);
3486 }
3487
3488 else {
3489 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3490 }
3491
3492 String sql = query.toString();
3493
3494 Session session = null;
3495
3496 try {
3497 session = openSession();
3498
3499 Query q = session.createQuery(sql);
3500
3501 QueryPos qPos = QueryPos.getInstance(q);
3502
3503 qPos.add(companyId);
3504
3505 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
3506 start, end);
3507 }
3508 catch (Exception e) {
3509 throw processException(e);
3510 }
3511 finally {
3512 if (list == null) {
3513 FinderCacheUtil.removeResult(finderPath, finderArgs);
3514 }
3515 else {
3516 cacheResult(list);
3517
3518 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3519 }
3520
3521 closeSession(session);
3522 }
3523 }
3524
3525 return list;
3526 }
3527
3528
3537 public JournalArticle findByCompanyId_First(long companyId,
3538 OrderByComparator orderByComparator)
3539 throws NoSuchArticleException, SystemException {
3540 JournalArticle journalArticle = fetchByCompanyId_First(companyId,
3541 orderByComparator);
3542
3543 if (journalArticle != null) {
3544 return journalArticle;
3545 }
3546
3547 StringBundler msg = new StringBundler(4);
3548
3549 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3550
3551 msg.append("companyId=");
3552 msg.append(companyId);
3553
3554 msg.append(StringPool.CLOSE_CURLY_BRACE);
3555
3556 throw new NoSuchArticleException(msg.toString());
3557 }
3558
3559
3567 public JournalArticle fetchByCompanyId_First(long companyId,
3568 OrderByComparator orderByComparator) throws SystemException {
3569 List<JournalArticle> list = findByCompanyId(companyId, 0, 1,
3570 orderByComparator);
3571
3572 if (!list.isEmpty()) {
3573 return list.get(0);
3574 }
3575
3576 return null;
3577 }
3578
3579
3588 public JournalArticle findByCompanyId_Last(long companyId,
3589 OrderByComparator orderByComparator)
3590 throws NoSuchArticleException, SystemException {
3591 JournalArticle journalArticle = fetchByCompanyId_Last(companyId,
3592 orderByComparator);
3593
3594 if (journalArticle != null) {
3595 return journalArticle;
3596 }
3597
3598 StringBundler msg = new StringBundler(4);
3599
3600 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3601
3602 msg.append("companyId=");
3603 msg.append(companyId);
3604
3605 msg.append(StringPool.CLOSE_CURLY_BRACE);
3606
3607 throw new NoSuchArticleException(msg.toString());
3608 }
3609
3610
3618 public JournalArticle fetchByCompanyId_Last(long companyId,
3619 OrderByComparator orderByComparator) throws SystemException {
3620 int count = countByCompanyId(companyId);
3621
3622 List<JournalArticle> list = findByCompanyId(companyId, count - 1,
3623 count, orderByComparator);
3624
3625 if (!list.isEmpty()) {
3626 return list.get(0);
3627 }
3628
3629 return null;
3630 }
3631
3632
3642 public JournalArticle[] findByCompanyId_PrevAndNext(long id,
3643 long companyId, OrderByComparator orderByComparator)
3644 throws NoSuchArticleException, SystemException {
3645 JournalArticle journalArticle = findByPrimaryKey(id);
3646
3647 Session session = null;
3648
3649 try {
3650 session = openSession();
3651
3652 JournalArticle[] array = new JournalArticleImpl[3];
3653
3654 array[0] = getByCompanyId_PrevAndNext(session, journalArticle,
3655 companyId, orderByComparator, true);
3656
3657 array[1] = journalArticle;
3658
3659 array[2] = getByCompanyId_PrevAndNext(session, journalArticle,
3660 companyId, orderByComparator, false);
3661
3662 return array;
3663 }
3664 catch (Exception e) {
3665 throw processException(e);
3666 }
3667 finally {
3668 closeSession(session);
3669 }
3670 }
3671
3672 protected JournalArticle getByCompanyId_PrevAndNext(Session session,
3673 JournalArticle journalArticle, long companyId,
3674 OrderByComparator orderByComparator, boolean previous) {
3675 StringBundler query = null;
3676
3677 if (orderByComparator != null) {
3678 query = new StringBundler(6 +
3679 (orderByComparator.getOrderByFields().length * 6));
3680 }
3681 else {
3682 query = new StringBundler(3);
3683 }
3684
3685 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3686
3687 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3688
3689 if (orderByComparator != null) {
3690 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3691
3692 if (orderByConditionFields.length > 0) {
3693 query.append(WHERE_AND);
3694 }
3695
3696 for (int i = 0; i < orderByConditionFields.length; i++) {
3697 query.append(_ORDER_BY_ENTITY_ALIAS);
3698 query.append(orderByConditionFields[i]);
3699
3700 if ((i + 1) < orderByConditionFields.length) {
3701 if (orderByComparator.isAscending() ^ previous) {
3702 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3703 }
3704 else {
3705 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3706 }
3707 }
3708 else {
3709 if (orderByComparator.isAscending() ^ previous) {
3710 query.append(WHERE_GREATER_THAN);
3711 }
3712 else {
3713 query.append(WHERE_LESSER_THAN);
3714 }
3715 }
3716 }
3717
3718 query.append(ORDER_BY_CLAUSE);
3719
3720 String[] orderByFields = orderByComparator.getOrderByFields();
3721
3722 for (int i = 0; i < orderByFields.length; i++) {
3723 query.append(_ORDER_BY_ENTITY_ALIAS);
3724 query.append(orderByFields[i]);
3725
3726 if ((i + 1) < orderByFields.length) {
3727 if (orderByComparator.isAscending() ^ previous) {
3728 query.append(ORDER_BY_ASC_HAS_NEXT);
3729 }
3730 else {
3731 query.append(ORDER_BY_DESC_HAS_NEXT);
3732 }
3733 }
3734 else {
3735 if (orderByComparator.isAscending() ^ previous) {
3736 query.append(ORDER_BY_ASC);
3737 }
3738 else {
3739 query.append(ORDER_BY_DESC);
3740 }
3741 }
3742 }
3743 }
3744
3745 else {
3746 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3747 }
3748
3749 String sql = query.toString();
3750
3751 Query q = session.createQuery(sql);
3752
3753 q.setFirstResult(0);
3754 q.setMaxResults(2);
3755
3756 QueryPos qPos = QueryPos.getInstance(q);
3757
3758 qPos.add(companyId);
3759
3760 if (orderByComparator != null) {
3761 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
3762
3763 for (Object value : values) {
3764 qPos.add(value);
3765 }
3766 }
3767
3768 List<JournalArticle> list = q.list();
3769
3770 if (list.size() == 2) {
3771 return list.get(1);
3772 }
3773 else {
3774 return null;
3775 }
3776 }
3777
3778
3785 public List<JournalArticle> findByStructureId(String structureId)
3786 throws SystemException {
3787 return findByStructureId(structureId, QueryUtil.ALL_POS,
3788 QueryUtil.ALL_POS, null);
3789 }
3790
3791
3804 public List<JournalArticle> findByStructureId(String structureId,
3805 int start, int end) throws SystemException {
3806 return findByStructureId(structureId, start, end, null);
3807 }
3808
3809
3823 public List<JournalArticle> findByStructureId(String structureId,
3824 int start, int end, OrderByComparator orderByComparator)
3825 throws SystemException {
3826 FinderPath finderPath = null;
3827 Object[] finderArgs = null;
3828
3829 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3830 (orderByComparator == null)) {
3831 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID;
3832 finderArgs = new Object[] { structureId };
3833 }
3834 else {
3835 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_STRUCTUREID;
3836 finderArgs = new Object[] { structureId, start, end, orderByComparator };
3837 }
3838
3839 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
3840 finderArgs, this);
3841
3842 if ((list != null) && !list.isEmpty()) {
3843 for (JournalArticle journalArticle : list) {
3844 if (!Validator.equals(structureId,
3845 journalArticle.getStructureId())) {
3846 list = null;
3847
3848 break;
3849 }
3850 }
3851 }
3852
3853 if (list == null) {
3854 StringBundler query = null;
3855
3856 if (orderByComparator != null) {
3857 query = new StringBundler(3 +
3858 (orderByComparator.getOrderByFields().length * 3));
3859 }
3860 else {
3861 query = new StringBundler(3);
3862 }
3863
3864 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3865
3866 if (structureId == null) {
3867 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1);
3868 }
3869 else {
3870 if (structureId.equals(StringPool.BLANK)) {
3871 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3);
3872 }
3873 else {
3874 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
3875 }
3876 }
3877
3878 if (orderByComparator != null) {
3879 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3880 orderByComparator);
3881 }
3882
3883 else {
3884 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3885 }
3886
3887 String sql = query.toString();
3888
3889 Session session = null;
3890
3891 try {
3892 session = openSession();
3893
3894 Query q = session.createQuery(sql);
3895
3896 QueryPos qPos = QueryPos.getInstance(q);
3897
3898 if (structureId != null) {
3899 qPos.add(structureId);
3900 }
3901
3902 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
3903 start, end);
3904 }
3905 catch (Exception e) {
3906 throw processException(e);
3907 }
3908 finally {
3909 if (list == null) {
3910 FinderCacheUtil.removeResult(finderPath, finderArgs);
3911 }
3912 else {
3913 cacheResult(list);
3914
3915 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3916 }
3917
3918 closeSession(session);
3919 }
3920 }
3921
3922 return list;
3923 }
3924
3925
3934 public JournalArticle findByStructureId_First(String structureId,
3935 OrderByComparator orderByComparator)
3936 throws NoSuchArticleException, SystemException {
3937 JournalArticle journalArticle = fetchByStructureId_First(structureId,
3938 orderByComparator);
3939
3940 if (journalArticle != null) {
3941 return journalArticle;
3942 }
3943
3944 StringBundler msg = new StringBundler(4);
3945
3946 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3947
3948 msg.append("structureId=");
3949 msg.append(structureId);
3950
3951 msg.append(StringPool.CLOSE_CURLY_BRACE);
3952
3953 throw new NoSuchArticleException(msg.toString());
3954 }
3955
3956
3964 public JournalArticle fetchByStructureId_First(String structureId,
3965 OrderByComparator orderByComparator) throws SystemException {
3966 List<JournalArticle> list = findByStructureId(structureId, 0, 1,
3967 orderByComparator);
3968
3969 if (!list.isEmpty()) {
3970 return list.get(0);
3971 }
3972
3973 return null;
3974 }
3975
3976
3985 public JournalArticle findByStructureId_Last(String structureId,
3986 OrderByComparator orderByComparator)
3987 throws NoSuchArticleException, SystemException {
3988 JournalArticle journalArticle = fetchByStructureId_Last(structureId,
3989 orderByComparator);
3990
3991 if (journalArticle != null) {
3992 return journalArticle;
3993 }
3994
3995 StringBundler msg = new StringBundler(4);
3996
3997 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3998
3999 msg.append("structureId=");
4000 msg.append(structureId);
4001
4002 msg.append(StringPool.CLOSE_CURLY_BRACE);
4003
4004 throw new NoSuchArticleException(msg.toString());
4005 }
4006
4007
4015 public JournalArticle fetchByStructureId_Last(String structureId,
4016 OrderByComparator orderByComparator) throws SystemException {
4017 int count = countByStructureId(structureId);
4018
4019 List<JournalArticle> list = findByStructureId(structureId, count - 1,
4020 count, orderByComparator);
4021
4022 if (!list.isEmpty()) {
4023 return list.get(0);
4024 }
4025
4026 return null;
4027 }
4028
4029
4039 public JournalArticle[] findByStructureId_PrevAndNext(long id,
4040 String structureId, OrderByComparator orderByComparator)
4041 throws NoSuchArticleException, SystemException {
4042 JournalArticle journalArticle = findByPrimaryKey(id);
4043
4044 Session session = null;
4045
4046 try {
4047 session = openSession();
4048
4049 JournalArticle[] array = new JournalArticleImpl[3];
4050
4051 array[0] = getByStructureId_PrevAndNext(session, journalArticle,
4052 structureId, orderByComparator, true);
4053
4054 array[1] = journalArticle;
4055
4056 array[2] = getByStructureId_PrevAndNext(session, journalArticle,
4057 structureId, orderByComparator, false);
4058
4059 return array;
4060 }
4061 catch (Exception e) {
4062 throw processException(e);
4063 }
4064 finally {
4065 closeSession(session);
4066 }
4067 }
4068
4069 protected JournalArticle getByStructureId_PrevAndNext(Session session,
4070 JournalArticle journalArticle, String structureId,
4071 OrderByComparator orderByComparator, boolean previous) {
4072 StringBundler query = null;
4073
4074 if (orderByComparator != null) {
4075 query = new StringBundler(6 +
4076 (orderByComparator.getOrderByFields().length * 6));
4077 }
4078 else {
4079 query = new StringBundler(3);
4080 }
4081
4082 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
4083
4084 if (structureId == null) {
4085 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1);
4086 }
4087 else {
4088 if (structureId.equals(StringPool.BLANK)) {
4089 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3);
4090 }
4091 else {
4092 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
4093 }
4094 }
4095
4096 if (orderByComparator != null) {
4097 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4098
4099 if (orderByConditionFields.length > 0) {
4100 query.append(WHERE_AND);
4101 }
4102
4103 for (int i = 0; i < orderByConditionFields.length; i++) {
4104 query.append(_ORDER_BY_ENTITY_ALIAS);
4105 query.append(orderByConditionFields[i]);
4106
4107 if ((i + 1) < orderByConditionFields.length) {
4108 if (orderByComparator.isAscending() ^ previous) {
4109 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4110 }
4111 else {
4112 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4113 }
4114 }
4115 else {
4116 if (orderByComparator.isAscending() ^ previous) {
4117 query.append(WHERE_GREATER_THAN);
4118 }
4119 else {
4120 query.append(WHERE_LESSER_THAN);
4121 }
4122 }
4123 }
4124
4125 query.append(ORDER_BY_CLAUSE);
4126
4127 String[] orderByFields = orderByComparator.getOrderByFields();
4128
4129 for (int i = 0; i < orderByFields.length; i++) {
4130 query.append(_ORDER_BY_ENTITY_ALIAS);
4131 query.append(orderByFields[i]);
4132
4133 if ((i + 1) < orderByFields.length) {
4134 if (orderByComparator.isAscending() ^ previous) {
4135 query.append(ORDER_BY_ASC_HAS_NEXT);
4136 }
4137 else {
4138 query.append(ORDER_BY_DESC_HAS_NEXT);
4139 }
4140 }
4141 else {
4142 if (orderByComparator.isAscending() ^ previous) {
4143 query.append(ORDER_BY_ASC);
4144 }
4145 else {
4146 query.append(ORDER_BY_DESC);
4147 }
4148 }
4149 }
4150 }
4151
4152 else {
4153 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
4154 }
4155
4156 String sql = query.toString();
4157
4158 Query q = session.createQuery(sql);
4159
4160 q.setFirstResult(0);
4161 q.setMaxResults(2);
4162
4163 QueryPos qPos = QueryPos.getInstance(q);
4164
4165 if (structureId != null) {
4166 qPos.add(structureId);
4167 }
4168
4169 if (orderByComparator != null) {
4170 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
4171
4172 for (Object value : values) {
4173 qPos.add(value);
4174 }
4175 }
4176
4177 List<JournalArticle> list = q.list();
4178
4179 if (list.size() == 2) {
4180 return list.get(1);
4181 }
4182 else {
4183 return null;
4184 }
4185 }
4186
4187
4194 public List<JournalArticle> findByTemplateId(String templateId)
4195 throws SystemException {
4196 return findByTemplateId(templateId, QueryUtil.ALL_POS,
4197 QueryUtil.ALL_POS, null);
4198 }
4199
4200
4213 public List<JournalArticle> findByTemplateId(String templateId, int start,
4214 int end) throws SystemException {
4215 return findByTemplateId(templateId, start, end, null);
4216 }
4217
4218
4232 public List<JournalArticle> findByTemplateId(String templateId, int start,
4233 int end, OrderByComparator orderByComparator) throws SystemException {
4234 FinderPath finderPath = null;
4235 Object[] finderArgs = null;
4236
4237 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4238 (orderByComparator == null)) {
4239 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEMPLATEID;
4240 finderArgs = new Object[] { templateId };
4241 }
4242 else {
4243 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TEMPLATEID;
4244 finderArgs = new Object[] { templateId, start, end, orderByComparator };
4245 }
4246
4247 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
4248 finderArgs, this);
4249
4250 if ((list != null) && !list.isEmpty()) {
4251 for (JournalArticle journalArticle : list) {
4252 if (!Validator.equals(templateId, journalArticle.getTemplateId())) {
4253 list = null;
4254
4255 break;
4256 }
4257 }
4258 }
4259
4260 if (list == null) {
4261 StringBundler query = null;
4262
4263 if (orderByComparator != null) {
4264 query = new StringBundler(3 +
4265 (orderByComparator.getOrderByFields().length * 3));
4266 }
4267 else {
4268 query = new StringBundler(3);
4269 }
4270
4271 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
4272
4273 if (templateId == null) {
4274 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
4275 }
4276 else {
4277 if (templateId.equals(StringPool.BLANK)) {
4278 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
4279 }
4280 else {
4281 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
4282 }
4283 }
4284
4285 if (orderByComparator != null) {
4286 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4287 orderByComparator);
4288 }
4289
4290 else {
4291 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
4292 }
4293
4294 String sql = query.toString();
4295
4296 Session session = null;
4297
4298 try {
4299 session = openSession();
4300
4301 Query q = session.createQuery(sql);
4302
4303 QueryPos qPos = QueryPos.getInstance(q);
4304
4305 if (templateId != null) {
4306 qPos.add(templateId);
4307 }
4308
4309 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
4310 start, end);
4311 }
4312 catch (Exception e) {
4313 throw processException(e);
4314 }
4315 finally {
4316 if (list == null) {
4317 FinderCacheUtil.removeResult(finderPath, finderArgs);
4318 }
4319 else {
4320 cacheResult(list);
4321
4322 FinderCacheUtil.putResult(finderPath, finderArgs, list);
4323 }
4324
4325 closeSession(session);
4326 }
4327 }
4328
4329 return list;
4330 }
4331
4332
4341 public JournalArticle findByTemplateId_First(String templateId,
4342 OrderByComparator orderByComparator)
4343 throws NoSuchArticleException, SystemException {
4344 JournalArticle journalArticle = fetchByTemplateId_First(templateId,
4345 orderByComparator);
4346
4347 if (journalArticle != null) {
4348 return journalArticle;
4349 }
4350
4351 StringBundler msg = new StringBundler(4);
4352
4353 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4354
4355 msg.append("templateId=");
4356 msg.append(templateId);
4357
4358 msg.append(StringPool.CLOSE_CURLY_BRACE);
4359
4360 throw new NoSuchArticleException(msg.toString());
4361 }
4362
4363
4371 public JournalArticle fetchByTemplateId_First(String templateId,
4372 OrderByComparator orderByComparator) throws SystemException {
4373 List<JournalArticle> list = findByTemplateId(templateId, 0, 1,
4374 orderByComparator);
4375
4376 if (!list.isEmpty()) {
4377 return list.get(0);
4378 }
4379
4380 return null;
4381 }
4382
4383
4392 public JournalArticle findByTemplateId_Last(String templateId,
4393 OrderByComparator orderByComparator)
4394 throws NoSuchArticleException, SystemException {
4395 JournalArticle journalArticle = fetchByTemplateId_Last(templateId,
4396 orderByComparator);
4397
4398 if (journalArticle != null) {
4399 return journalArticle;
4400 }
4401
4402 StringBundler msg = new StringBundler(4);
4403
4404 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4405
4406 msg.append("templateId=");
4407 msg.append(templateId);
4408
4409 msg.append(StringPool.CLOSE_CURLY_BRACE);
4410
4411 throw new NoSuchArticleException(msg.toString());
4412 }
4413
4414
4422 public JournalArticle fetchByTemplateId_Last(String templateId,
4423 OrderByComparator orderByComparator) throws SystemException {
4424 int count = countByTemplateId(templateId);
4425
4426 List<JournalArticle> list = findByTemplateId(templateId, count - 1,
4427 count, orderByComparator);
4428
4429 if (!list.isEmpty()) {
4430 return list.get(0);
4431 }
4432
4433 return null;
4434 }
4435
4436
4446 public JournalArticle[] findByTemplateId_PrevAndNext(long id,
4447 String templateId, OrderByComparator orderByComparator)
4448 throws NoSuchArticleException, SystemException {
4449 JournalArticle journalArticle = findByPrimaryKey(id);
4450
4451 Session session = null;
4452
4453 try {
4454 session = openSession();
4455
4456 JournalArticle[] array = new JournalArticleImpl[3];
4457
4458 array[0] = getByTemplateId_PrevAndNext(session, journalArticle,
4459 templateId, orderByComparator, true);
4460
4461 array[1] = journalArticle;
4462
4463 array[2] = getByTemplateId_PrevAndNext(session, journalArticle,
4464 templateId, orderByComparator, false);
4465
4466 return array;
4467 }
4468 catch (Exception e) {
4469 throw processException(e);
4470 }
4471 finally {
4472 closeSession(session);
4473 }
4474 }
4475
4476 protected JournalArticle getByTemplateId_PrevAndNext(Session session,
4477 JournalArticle journalArticle, String templateId,
4478 OrderByComparator orderByComparator, boolean previous) {
4479 StringBundler query = null;
4480
4481 if (orderByComparator != null) {
4482 query = new StringBundler(6 +
4483 (orderByComparator.getOrderByFields().length * 6));
4484 }
4485 else {
4486 query = new StringBundler(3);
4487 }
4488
4489 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
4490
4491 if (templateId == null) {
4492 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
4493 }
4494 else {
4495 if (templateId.equals(StringPool.BLANK)) {
4496 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
4497 }
4498 else {
4499 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
4500 }
4501 }
4502
4503 if (orderByComparator != null) {
4504 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4505
4506 if (orderByConditionFields.length > 0) {
4507 query.append(WHERE_AND);
4508 }
4509
4510 for (int i = 0; i < orderByConditionFields.length; i++) {
4511 query.append(_ORDER_BY_ENTITY_ALIAS);
4512 query.append(orderByConditionFields[i]);
4513
4514 if ((i + 1) < orderByConditionFields.length) {
4515 if (orderByComparator.isAscending() ^ previous) {
4516 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4517 }
4518 else {
4519 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4520 }
4521 }
4522 else {
4523 if (orderByComparator.isAscending() ^ previous) {
4524 query.append(WHERE_GREATER_THAN);
4525 }
4526 else {
4527 query.append(WHERE_LESSER_THAN);
4528 }
4529 }
4530 }
4531
4532 query.append(ORDER_BY_CLAUSE);
4533
4534 String[] orderByFields = orderByComparator.getOrderByFields();
4535
4536 for (int i = 0; i < orderByFields.length; i++) {
4537 query.append(_ORDER_BY_ENTITY_ALIAS);
4538 query.append(orderByFields[i]);
4539
4540 if ((i + 1) < orderByFields.length) {
4541 if (orderByComparator.isAscending() ^ previous) {
4542 query.append(ORDER_BY_ASC_HAS_NEXT);
4543 }
4544 else {
4545 query.append(ORDER_BY_DESC_HAS_NEXT);
4546 }
4547 }
4548 else {
4549 if (orderByComparator.isAscending() ^ previous) {
4550 query.append(ORDER_BY_ASC);
4551 }
4552 else {
4553 query.append(ORDER_BY_DESC);
4554 }
4555 }
4556 }
4557 }
4558
4559 else {
4560 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
4561 }
4562
4563 String sql = query.toString();
4564
4565 Query q = session.createQuery(sql);
4566
4567 q.setFirstResult(0);
4568 q.setMaxResults(2);
4569
4570 QueryPos qPos = QueryPos.getInstance(q);
4571
4572 if (templateId != null) {
4573 qPos.add(templateId);
4574 }
4575
4576 if (orderByComparator != null) {
4577 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
4578
4579 for (Object value : values) {
4580 qPos.add(value);
4581 }
4582 }
4583
4584 List<JournalArticle> list = q.list();
4585
4586 if (list.size() == 2) {
4587 return list.get(1);
4588 }
4589 else {
4590 return null;
4591 }
4592 }
4593
4594
4601 public List<JournalArticle> findByLayoutUuid(String layoutUuid)
4602 throws SystemException {
4603 return findByLayoutUuid(layoutUuid, QueryUtil.ALL_POS,
4604 QueryUtil.ALL_POS, null);
4605 }
4606
4607
4620 public List<JournalArticle> findByLayoutUuid(String layoutUuid, int start,
4621 int end) throws SystemException {
4622 return findByLayoutUuid(layoutUuid, start, end, null);
4623 }
4624
4625
4639 public List<JournalArticle> findByLayoutUuid(String layoutUuid, int start,
4640 int end, OrderByComparator orderByComparator) throws SystemException {
4641 FinderPath finderPath = null;
4642 Object[] finderArgs = null;
4643
4644 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4645 (orderByComparator == null)) {
4646 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTUUID;
4647 finderArgs = new Object[] { layoutUuid };
4648 }
4649 else {
4650 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_LAYOUTUUID;
4651 finderArgs = new Object[] { layoutUuid, start, end, orderByComparator };
4652 }
4653
4654 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
4655 finderArgs, this);
4656
4657 if ((list != null) && !list.isEmpty()) {
4658 for (JournalArticle journalArticle : list) {
4659 if (!Validator.equals(layoutUuid, journalArticle.getLayoutUuid())) {
4660 list = null;
4661
4662 break;
4663 }
4664 }
4665 }
4666
4667 if (list == null) {
4668 StringBundler query = null;
4669
4670 if (orderByComparator != null) {
4671 query = new StringBundler(3 +
4672 (orderByComparator.getOrderByFields().length * 3));
4673 }
4674 else {
4675 query = new StringBundler(3);
4676 }
4677
4678 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
4679
4680 if (layoutUuid == null) {
4681 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_1);
4682 }
4683 else {
4684 if (layoutUuid.equals(StringPool.BLANK)) {
4685 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_3);
4686 }
4687 else {
4688 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_2);
4689 }
4690 }
4691
4692 if (orderByComparator != null) {
4693 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4694 orderByComparator);
4695 }
4696
4697 else {
4698 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
4699 }
4700
4701 String sql = query.toString();
4702
4703 Session session = null;
4704
4705 try {
4706 session = openSession();
4707
4708 Query q = session.createQuery(sql);
4709
4710 QueryPos qPos = QueryPos.getInstance(q);
4711
4712 if (layoutUuid != null) {
4713 qPos.add(layoutUuid);
4714 }
4715
4716 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
4717 start, end);
4718 }
4719 catch (Exception e) {
4720 throw processException(e);
4721 }
4722 finally {
4723 if (list == null) {
4724 FinderCacheUtil.removeResult(finderPath, finderArgs);
4725 }
4726 else {
4727 cacheResult(list);
4728
4729 FinderCacheUtil.putResult(finderPath, finderArgs, list);
4730 }
4731
4732 closeSession(session);
4733 }
4734 }
4735
4736 return list;
4737 }
4738
4739
4748 public JournalArticle findByLayoutUuid_First(String layoutUuid,
4749 OrderByComparator orderByComparator)
4750 throws NoSuchArticleException, SystemException {
4751 JournalArticle journalArticle = fetchByLayoutUuid_First(layoutUuid,
4752 orderByComparator);
4753
4754 if (journalArticle != null) {
4755 return journalArticle;
4756 }
4757
4758 StringBundler msg = new StringBundler(4);
4759
4760 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4761
4762 msg.append("layoutUuid=");
4763 msg.append(layoutUuid);
4764
4765 msg.append(StringPool.CLOSE_CURLY_BRACE);
4766
4767 throw new NoSuchArticleException(msg.toString());
4768 }
4769
4770
4778 public JournalArticle fetchByLayoutUuid_First(String layoutUuid,
4779 OrderByComparator orderByComparator) throws SystemException {
4780 List<JournalArticle> list = findByLayoutUuid(layoutUuid, 0, 1,
4781 orderByComparator);
4782
4783 if (!list.isEmpty()) {
4784 return list.get(0);
4785 }
4786
4787 return null;
4788 }
4789
4790
4799 public JournalArticle findByLayoutUuid_Last(String layoutUuid,
4800 OrderByComparator orderByComparator)
4801 throws NoSuchArticleException, SystemException {
4802 JournalArticle journalArticle = fetchByLayoutUuid_Last(layoutUuid,
4803 orderByComparator);
4804
4805 if (journalArticle != null) {
4806 return journalArticle;
4807 }
4808
4809 StringBundler msg = new StringBundler(4);
4810
4811 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4812
4813 msg.append("layoutUuid=");
4814 msg.append(layoutUuid);
4815
4816 msg.append(StringPool.CLOSE_CURLY_BRACE);
4817
4818 throw new NoSuchArticleException(msg.toString());
4819 }
4820
4821
4829 public JournalArticle fetchByLayoutUuid_Last(String layoutUuid,
4830 OrderByComparator orderByComparator) throws SystemException {
4831 int count = countByLayoutUuid(layoutUuid);
4832
4833 List<JournalArticle> list = findByLayoutUuid(layoutUuid, count - 1,
4834 count, orderByComparator);
4835
4836 if (!list.isEmpty()) {
4837 return list.get(0);
4838 }
4839
4840 return null;
4841 }
4842
4843
4853 public JournalArticle[] findByLayoutUuid_PrevAndNext(long id,
4854 String layoutUuid, OrderByComparator orderByComparator)
4855 throws NoSuchArticleException, SystemException {
4856 JournalArticle journalArticle = findByPrimaryKey(id);
4857
4858 Session session = null;
4859
4860 try {
4861 session = openSession();
4862
4863 JournalArticle[] array = new JournalArticleImpl[3];
4864
4865 array[0] = getByLayoutUuid_PrevAndNext(session, journalArticle,
4866 layoutUuid, orderByComparator, true);
4867
4868 array[1] = journalArticle;
4869
4870 array[2] = getByLayoutUuid_PrevAndNext(session, journalArticle,
4871 layoutUuid, orderByComparator, false);
4872
4873 return array;
4874 }
4875 catch (Exception e) {
4876 throw processException(e);
4877 }
4878 finally {
4879 closeSession(session);
4880 }
4881 }
4882
4883 protected JournalArticle getByLayoutUuid_PrevAndNext(Session session,
4884 JournalArticle journalArticle, String layoutUuid,
4885 OrderByComparator orderByComparator, boolean previous) {
4886 StringBundler query = null;
4887
4888 if (orderByComparator != null) {
4889 query = new StringBundler(6 +
4890 (orderByComparator.getOrderByFields().length * 6));
4891 }
4892 else {
4893 query = new StringBundler(3);
4894 }
4895
4896 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
4897
4898 if (layoutUuid == null) {
4899 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_1);
4900 }
4901 else {
4902 if (layoutUuid.equals(StringPool.BLANK)) {
4903 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_3);
4904 }
4905 else {
4906 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_2);
4907 }
4908 }
4909
4910 if (orderByComparator != null) {
4911 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4912
4913 if (orderByConditionFields.length > 0) {
4914 query.append(WHERE_AND);
4915 }
4916
4917 for (int i = 0; i < orderByConditionFields.length; i++) {
4918 query.append(_ORDER_BY_ENTITY_ALIAS);
4919 query.append(orderByConditionFields[i]);
4920
4921 if ((i + 1) < orderByConditionFields.length) {
4922 if (orderByComparator.isAscending() ^ previous) {
4923 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4924 }
4925 else {
4926 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4927 }
4928 }
4929 else {
4930 if (orderByComparator.isAscending() ^ previous) {
4931 query.append(WHERE_GREATER_THAN);
4932 }
4933 else {
4934 query.append(WHERE_LESSER_THAN);
4935 }
4936 }
4937 }
4938
4939 query.append(ORDER_BY_CLAUSE);
4940
4941 String[] orderByFields = orderByComparator.getOrderByFields();
4942
4943 for (int i = 0; i < orderByFields.length; i++) {
4944 query.append(_ORDER_BY_ENTITY_ALIAS);
4945 query.append(orderByFields[i]);
4946
4947 if ((i + 1) < orderByFields.length) {
4948 if (orderByComparator.isAscending() ^ previous) {
4949 query.append(ORDER_BY_ASC_HAS_NEXT);
4950 }
4951 else {
4952 query.append(ORDER_BY_DESC_HAS_NEXT);
4953 }
4954 }
4955 else {
4956 if (orderByComparator.isAscending() ^ previous) {
4957 query.append(ORDER_BY_ASC);
4958 }
4959 else {
4960 query.append(ORDER_BY_DESC);
4961 }
4962 }
4963 }
4964 }
4965
4966 else {
4967 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
4968 }
4969
4970 String sql = query.toString();
4971
4972 Query q = session.createQuery(sql);
4973
4974 q.setFirstResult(0);
4975 q.setMaxResults(2);
4976
4977 QueryPos qPos = QueryPos.getInstance(q);
4978
4979 if (layoutUuid != null) {
4980 qPos.add(layoutUuid);
4981 }
4982
4983 if (orderByComparator != null) {
4984 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
4985
4986 for (Object value : values) {
4987 qPos.add(value);
4988 }
4989 }
4990
4991 List<JournalArticle> list = q.list();
4992
4993 if (list.size() == 2) {
4994 return list.get(1);
4995 }
4996 else {
4997 return null;
4998 }
4999 }
5000
5001
5008 public List<JournalArticle> findBySmallImageId(long smallImageId)
5009 throws SystemException {
5010 return findBySmallImageId(smallImageId, QueryUtil.ALL_POS,
5011 QueryUtil.ALL_POS, null);
5012 }
5013
5014
5027 public List<JournalArticle> findBySmallImageId(long smallImageId,
5028 int start, int end) throws SystemException {
5029 return findBySmallImageId(smallImageId, start, end, null);
5030 }
5031
5032
5046 public List<JournalArticle> findBySmallImageId(long smallImageId,
5047 int start, int end, OrderByComparator orderByComparator)
5048 throws SystemException {
5049 FinderPath finderPath = null;
5050 Object[] finderArgs = null;
5051
5052 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
5053 (orderByComparator == null)) {
5054 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SMALLIMAGEID;
5055 finderArgs = new Object[] { smallImageId };
5056 }
5057 else {
5058 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SMALLIMAGEID;
5059 finderArgs = new Object[] {
5060 smallImageId,
5061
5062 start, end, orderByComparator
5063 };
5064 }
5065
5066 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
5067 finderArgs, this);
5068
5069 if ((list != null) && !list.isEmpty()) {
5070 for (JournalArticle journalArticle : list) {
5071 if ((smallImageId != journalArticle.getSmallImageId())) {
5072 list = null;
5073
5074 break;
5075 }
5076 }
5077 }
5078
5079 if (list == null) {
5080 StringBundler query = null;
5081
5082 if (orderByComparator != null) {
5083 query = new StringBundler(3 +
5084 (orderByComparator.getOrderByFields().length * 3));
5085 }
5086 else {
5087 query = new StringBundler(3);
5088 }
5089
5090 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
5091
5092 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
5093
5094 if (orderByComparator != null) {
5095 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5096 orderByComparator);
5097 }
5098
5099 else {
5100 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
5101 }
5102
5103 String sql = query.toString();
5104
5105 Session session = null;
5106
5107 try {
5108 session = openSession();
5109
5110 Query q = session.createQuery(sql);
5111
5112 QueryPos qPos = QueryPos.getInstance(q);
5113
5114 qPos.add(smallImageId);
5115
5116 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
5117 start, end);
5118 }
5119 catch (Exception e) {
5120 throw processException(e);
5121 }
5122 finally {
5123 if (list == null) {
5124 FinderCacheUtil.removeResult(finderPath, finderArgs);
5125 }
5126 else {
5127 cacheResult(list);
5128
5129 FinderCacheUtil.putResult(finderPath, finderArgs, list);
5130 }
5131
5132 closeSession(session);
5133 }
5134 }
5135
5136 return list;
5137 }
5138
5139
5148 public JournalArticle findBySmallImageId_First(long smallImageId,
5149 OrderByComparator orderByComparator)
5150 throws NoSuchArticleException, SystemException {
5151 JournalArticle journalArticle = fetchBySmallImageId_First(smallImageId,
5152 orderByComparator);
5153
5154 if (journalArticle != null) {
5155 return journalArticle;
5156 }
5157
5158 StringBundler msg = new StringBundler(4);
5159
5160 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5161
5162 msg.append("smallImageId=");
5163 msg.append(smallImageId);
5164
5165 msg.append(StringPool.CLOSE_CURLY_BRACE);
5166
5167 throw new NoSuchArticleException(msg.toString());
5168 }
5169
5170
5178 public JournalArticle fetchBySmallImageId_First(long smallImageId,
5179 OrderByComparator orderByComparator) throws SystemException {
5180 List<JournalArticle> list = findBySmallImageId(smallImageId, 0, 1,
5181 orderByComparator);
5182
5183 if (!list.isEmpty()) {
5184 return list.get(0);
5185 }
5186
5187 return null;
5188 }
5189
5190
5199 public JournalArticle findBySmallImageId_Last(long smallImageId,
5200 OrderByComparator orderByComparator)
5201 throws NoSuchArticleException, SystemException {
5202 JournalArticle journalArticle = fetchBySmallImageId_Last(smallImageId,
5203 orderByComparator);
5204
5205 if (journalArticle != null) {
5206 return journalArticle;
5207 }
5208
5209 StringBundler msg = new StringBundler(4);
5210
5211 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5212
5213 msg.append("smallImageId=");
5214 msg.append(smallImageId);
5215
5216 msg.append(StringPool.CLOSE_CURLY_BRACE);
5217
5218 throw new NoSuchArticleException(msg.toString());
5219 }
5220
5221
5229 public JournalArticle fetchBySmallImageId_Last(long smallImageId,
5230 OrderByComparator orderByComparator) throws SystemException {
5231 int count = countBySmallImageId(smallImageId);
5232
5233 List<JournalArticle> list = findBySmallImageId(smallImageId, count - 1,
5234 count, orderByComparator);
5235
5236 if (!list.isEmpty()) {
5237 return list.get(0);
5238 }
5239
5240 return null;
5241 }
5242
5243
5253 public JournalArticle[] findBySmallImageId_PrevAndNext(long id,
5254 long smallImageId, OrderByComparator orderByComparator)
5255 throws NoSuchArticleException, SystemException {
5256 JournalArticle journalArticle = findByPrimaryKey(id);
5257
5258 Session session = null;
5259
5260 try {
5261 session = openSession();
5262
5263 JournalArticle[] array = new JournalArticleImpl[3];
5264
5265 array[0] = getBySmallImageId_PrevAndNext(session, journalArticle,
5266 smallImageId, orderByComparator, true);
5267
5268 array[1] = journalArticle;
5269
5270 array[2] = getBySmallImageId_PrevAndNext(session, journalArticle,
5271 smallImageId, orderByComparator, false);
5272
5273 return array;
5274 }
5275 catch (Exception e) {
5276 throw processException(e);
5277 }
5278 finally {
5279 closeSession(session);
5280 }
5281 }
5282
5283 protected JournalArticle getBySmallImageId_PrevAndNext(Session session,
5284 JournalArticle journalArticle, long smallImageId,
5285 OrderByComparator orderByComparator, boolean previous) {
5286 StringBundler query = null;
5287
5288 if (orderByComparator != null) {
5289 query = new StringBundler(6 +
5290 (orderByComparator.getOrderByFields().length * 6));
5291 }
5292 else {
5293 query = new StringBundler(3);
5294 }
5295
5296 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
5297
5298 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
5299
5300 if (orderByComparator != null) {
5301 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5302
5303 if (orderByConditionFields.length > 0) {
5304 query.append(WHERE_AND);
5305 }
5306
5307 for (int i = 0; i < orderByConditionFields.length; i++) {
5308 query.append(_ORDER_BY_ENTITY_ALIAS);
5309 query.append(orderByConditionFields[i]);
5310
5311 if ((i + 1) < orderByConditionFields.length) {
5312 if (orderByComparator.isAscending() ^ previous) {
5313 query.append(WHERE_GREATER_THAN_HAS_NEXT);
5314 }
5315 else {
5316 query.append(WHERE_LESSER_THAN_HAS_NEXT);
5317 }
5318 }
5319 else {
5320 if (orderByComparator.isAscending() ^ previous) {
5321 query.append(WHERE_GREATER_THAN);
5322 }
5323 else {
5324 query.append(WHERE_LESSER_THAN);
5325 }
5326 }
5327 }
5328
5329 query.append(ORDER_BY_CLAUSE);
5330
5331 String[] orderByFields = orderByComparator.getOrderByFields();
5332
5333 for (int i = 0; i < orderByFields.length; i++) {
5334 query.append(_ORDER_BY_ENTITY_ALIAS);
5335 query.append(orderByFields[i]);
5336
5337 if ((i + 1) < orderByFields.length) {
5338 if (orderByComparator.isAscending() ^ previous) {
5339 query.append(ORDER_BY_ASC_HAS_NEXT);
5340 }
5341 else {
5342 query.append(ORDER_BY_DESC_HAS_NEXT);
5343 }
5344 }
5345 else {
5346 if (orderByComparator.isAscending() ^ previous) {
5347 query.append(ORDER_BY_ASC);
5348 }
5349 else {
5350 query.append(ORDER_BY_DESC);
5351 }
5352 }
5353 }
5354 }
5355
5356 else {
5357 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
5358 }
5359
5360 String sql = query.toString();
5361
5362 Query q = session.createQuery(sql);
5363
5364 q.setFirstResult(0);
5365 q.setMaxResults(2);
5366
5367 QueryPos qPos = QueryPos.getInstance(q);
5368
5369 qPos.add(smallImageId);
5370
5371 if (orderByComparator != null) {
5372 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
5373
5374 for (Object value : values) {
5375 qPos.add(value);
5376 }
5377 }
5378
5379 List<JournalArticle> list = q.list();
5380
5381 if (list.size() == 2) {
5382 return list.get(1);
5383 }
5384 else {
5385 return null;
5386 }
5387 }
5388
5389
5397 public List<JournalArticle> findByR_ST(long resourcePrimKey, int status)
5398 throws SystemException {
5399 return findByR_ST(resourcePrimKey, status, QueryUtil.ALL_POS,
5400 QueryUtil.ALL_POS, null);
5401 }
5402
5403
5417 public List<JournalArticle> findByR_ST(long resourcePrimKey, int status,
5418 int start, int end) throws SystemException {
5419 return findByR_ST(resourcePrimKey, status, start, end, null);
5420 }
5421
5422
5437 public List<JournalArticle> findByR_ST(long resourcePrimKey, int status,
5438 int start, int end, OrderByComparator orderByComparator)
5439 throws SystemException {
5440 FinderPath finderPath = null;
5441 Object[] finderArgs = null;
5442
5443 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
5444 (orderByComparator == null)) {
5445 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_R_ST;
5446 finderArgs = new Object[] { resourcePrimKey, status };
5447 }
5448 else {
5449 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_R_ST;
5450 finderArgs = new Object[] {
5451 resourcePrimKey, status,
5452
5453 start, end, orderByComparator
5454 };
5455 }
5456
5457 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
5458 finderArgs, this);
5459
5460 if ((list != null) && !list.isEmpty()) {
5461 for (JournalArticle journalArticle : list) {
5462 if ((resourcePrimKey != journalArticle.getResourcePrimKey()) ||
5463 (status != journalArticle.getStatus())) {
5464 list = null;
5465
5466 break;
5467 }
5468 }
5469 }
5470
5471 if (list == null) {
5472 StringBundler query = null;
5473
5474 if (orderByComparator != null) {
5475 query = new StringBundler(4 +
5476 (orderByComparator.getOrderByFields().length * 3));
5477 }
5478 else {
5479 query = new StringBundler(4);
5480 }
5481
5482 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
5483
5484 query.append(_FINDER_COLUMN_R_ST_RESOURCEPRIMKEY_2);
5485
5486 query.append(_FINDER_COLUMN_R_ST_STATUS_2);
5487
5488 if (orderByComparator != null) {
5489 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5490 orderByComparator);
5491 }
5492
5493 else {
5494 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
5495 }
5496
5497 String sql = query.toString();
5498
5499 Session session = null;
5500
5501 try {
5502 session = openSession();
5503
5504 Query q = session.createQuery(sql);
5505
5506 QueryPos qPos = QueryPos.getInstance(q);
5507
5508 qPos.add(resourcePrimKey);
5509
5510 qPos.add(status);
5511
5512 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
5513 start, end);
5514 }
5515 catch (Exception e) {
5516 throw processException(e);
5517 }
5518 finally {
5519 if (list == null) {
5520 FinderCacheUtil.removeResult(finderPath, finderArgs);
5521 }
5522 else {
5523 cacheResult(list);
5524
5525 FinderCacheUtil.putResult(finderPath, finderArgs, list);
5526 }
5527
5528 closeSession(session);
5529 }
5530 }
5531
5532 return list;
5533 }
5534
5535
5545 public JournalArticle findByR_ST_First(long resourcePrimKey, int status,
5546 OrderByComparator orderByComparator)
5547 throws NoSuchArticleException, SystemException {
5548 JournalArticle journalArticle = fetchByR_ST_First(resourcePrimKey,
5549 status, orderByComparator);
5550
5551 if (journalArticle != null) {
5552 return journalArticle;
5553 }
5554
5555 StringBundler msg = new StringBundler(6);
5556
5557 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5558
5559 msg.append("resourcePrimKey=");
5560 msg.append(resourcePrimKey);
5561
5562 msg.append(", status=");
5563 msg.append(status);
5564
5565 msg.append(StringPool.CLOSE_CURLY_BRACE);
5566
5567 throw new NoSuchArticleException(msg.toString());
5568 }
5569
5570
5579 public JournalArticle fetchByR_ST_First(long resourcePrimKey, int status,
5580 OrderByComparator orderByComparator) throws SystemException {
5581 List<JournalArticle> list = findByR_ST(resourcePrimKey, status, 0, 1,
5582 orderByComparator);
5583
5584 if (!list.isEmpty()) {
5585 return list.get(0);
5586 }
5587
5588 return null;
5589 }
5590
5591
5601 public JournalArticle findByR_ST_Last(long resourcePrimKey, int status,
5602 OrderByComparator orderByComparator)
5603 throws NoSuchArticleException, SystemException {
5604 JournalArticle journalArticle = fetchByR_ST_Last(resourcePrimKey,
5605 status, orderByComparator);
5606
5607 if (journalArticle != null) {
5608 return journalArticle;
5609 }
5610
5611 StringBundler msg = new StringBundler(6);
5612
5613 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5614
5615 msg.append("resourcePrimKey=");
5616 msg.append(resourcePrimKey);
5617
5618 msg.append(", status=");
5619 msg.append(status);
5620
5621 msg.append(StringPool.CLOSE_CURLY_BRACE);
5622
5623 throw new NoSuchArticleException(msg.toString());
5624 }
5625
5626
5635 public JournalArticle fetchByR_ST_Last(long resourcePrimKey, int status,
5636 OrderByComparator orderByComparator) throws SystemException {
5637 int count = countByR_ST(resourcePrimKey, status);
5638
5639 List<JournalArticle> list = findByR_ST(resourcePrimKey, status,
5640 count - 1, count, orderByComparator);
5641
5642 if (!list.isEmpty()) {
5643 return list.get(0);
5644 }
5645
5646 return null;
5647 }
5648
5649
5660 public JournalArticle[] findByR_ST_PrevAndNext(long id,
5661 long resourcePrimKey, int status, OrderByComparator orderByComparator)
5662 throws NoSuchArticleException, SystemException {
5663 JournalArticle journalArticle = findByPrimaryKey(id);
5664
5665 Session session = null;
5666
5667 try {
5668 session = openSession();
5669
5670 JournalArticle[] array = new JournalArticleImpl[3];
5671
5672 array[0] = getByR_ST_PrevAndNext(session, journalArticle,
5673 resourcePrimKey, status, orderByComparator, true);
5674
5675 array[1] = journalArticle;
5676
5677 array[2] = getByR_ST_PrevAndNext(session, journalArticle,
5678 resourcePrimKey, status, orderByComparator, false);
5679
5680 return array;
5681 }
5682 catch (Exception e) {
5683 throw processException(e);
5684 }
5685 finally {
5686 closeSession(session);
5687 }
5688 }
5689
5690 protected JournalArticle getByR_ST_PrevAndNext(Session session,
5691 JournalArticle journalArticle, long resourcePrimKey, int status,
5692 OrderByComparator orderByComparator, boolean previous) {
5693 StringBundler query = null;
5694
5695 if (orderByComparator != null) {
5696 query = new StringBundler(6 +
5697 (orderByComparator.getOrderByFields().length * 6));
5698 }
5699 else {
5700 query = new StringBundler(3);
5701 }
5702
5703 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
5704
5705 query.append(_FINDER_COLUMN_R_ST_RESOURCEPRIMKEY_2);
5706
5707 query.append(_FINDER_COLUMN_R_ST_STATUS_2);
5708
5709 if (orderByComparator != null) {
5710 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5711
5712 if (orderByConditionFields.length > 0) {
5713 query.append(WHERE_AND);
5714 }
5715
5716 for (int i = 0; i < orderByConditionFields.length; i++) {
5717 query.append(_ORDER_BY_ENTITY_ALIAS);
5718 query.append(orderByConditionFields[i]);
5719
5720 if ((i + 1) < orderByConditionFields.length) {
5721 if (orderByComparator.isAscending() ^ previous) {
5722 query.append(WHERE_GREATER_THAN_HAS_NEXT);
5723 }
5724 else {
5725 query.append(WHERE_LESSER_THAN_HAS_NEXT);
5726 }
5727 }
5728 else {
5729 if (orderByComparator.isAscending() ^ previous) {
5730 query.append(WHERE_GREATER_THAN);
5731 }
5732 else {
5733 query.append(WHERE_LESSER_THAN);
5734 }
5735 }
5736 }
5737
5738 query.append(ORDER_BY_CLAUSE);
5739
5740 String[] orderByFields = orderByComparator.getOrderByFields();
5741
5742 for (int i = 0; i < orderByFields.length; i++) {
5743 query.append(_ORDER_BY_ENTITY_ALIAS);
5744 query.append(orderByFields[i]);
5745
5746 if ((i + 1) < orderByFields.length) {
5747 if (orderByComparator.isAscending() ^ previous) {
5748 query.append(ORDER_BY_ASC_HAS_NEXT);
5749 }
5750 else {
5751 query.append(ORDER_BY_DESC_HAS_NEXT);
5752 }
5753 }
5754 else {
5755 if (orderByComparator.isAscending() ^ previous) {
5756 query.append(ORDER_BY_ASC);
5757 }
5758 else {
5759 query.append(ORDER_BY_DESC);
5760 }
5761 }
5762 }
5763 }
5764
5765 else {
5766 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
5767 }
5768
5769 String sql = query.toString();
5770
5771 Query q = session.createQuery(sql);
5772
5773 q.setFirstResult(0);
5774 q.setMaxResults(2);
5775
5776 QueryPos qPos = QueryPos.getInstance(q);
5777
5778 qPos.add(resourcePrimKey);
5779
5780 qPos.add(status);
5781
5782 if (orderByComparator != null) {
5783 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
5784
5785 for (Object value : values) {
5786 qPos.add(value);
5787 }
5788 }
5789
5790 List<JournalArticle> list = q.list();
5791
5792 if (list.size() == 2) {
5793 return list.get(1);
5794 }
5795 else {
5796 return null;
5797 }
5798 }
5799
5800
5808 public List<JournalArticle> findByG_A(long groupId, String articleId)
5809 throws SystemException {
5810 return findByG_A(groupId, articleId, QueryUtil.ALL_POS,
5811 QueryUtil.ALL_POS, null);
5812 }
5813
5814
5828 public List<JournalArticle> findByG_A(long groupId, String articleId,
5829 int start, int end) throws SystemException {
5830 return findByG_A(groupId, articleId, start, end, null);
5831 }
5832
5833
5848 public List<JournalArticle> findByG_A(long groupId, String articleId,
5849 int start, int end, OrderByComparator orderByComparator)
5850 throws SystemException {
5851 FinderPath finderPath = null;
5852 Object[] finderArgs = null;
5853
5854 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
5855 (orderByComparator == null)) {
5856 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A;
5857 finderArgs = new Object[] { groupId, articleId };
5858 }
5859 else {
5860 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_A;
5861 finderArgs = new Object[] {
5862 groupId, articleId,
5863
5864 start, end, orderByComparator
5865 };
5866 }
5867
5868 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
5869 finderArgs, this);
5870
5871 if ((list != null) && !list.isEmpty()) {
5872 for (JournalArticle journalArticle : list) {
5873 if ((groupId != journalArticle.getGroupId()) ||
5874 !Validator.equals(articleId,
5875 journalArticle.getArticleId())) {
5876 list = null;
5877
5878 break;
5879 }
5880 }
5881 }
5882
5883 if (list == null) {
5884 StringBundler query = null;
5885
5886 if (orderByComparator != null) {
5887 query = new StringBundler(4 +
5888 (orderByComparator.getOrderByFields().length * 3));
5889 }
5890 else {
5891 query = new StringBundler(4);
5892 }
5893
5894 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
5895
5896 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
5897
5898 if (articleId == null) {
5899 query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
5900 }
5901 else {
5902 if (articleId.equals(StringPool.BLANK)) {
5903 query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
5904 }
5905 else {
5906 query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
5907 }
5908 }
5909
5910 if (orderByComparator != null) {
5911 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5912 orderByComparator);
5913 }
5914
5915 else {
5916 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
5917 }
5918
5919 String sql = query.toString();
5920
5921 Session session = null;
5922
5923 try {
5924 session = openSession();
5925
5926 Query q = session.createQuery(sql);
5927
5928 QueryPos qPos = QueryPos.getInstance(q);
5929
5930 qPos.add(groupId);
5931
5932 if (articleId != null) {
5933 qPos.add(articleId);
5934 }
5935
5936 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
5937 start, end);
5938 }
5939 catch (Exception e) {
5940 throw processException(e);
5941 }
5942 finally {
5943 if (list == null) {
5944 FinderCacheUtil.removeResult(finderPath, finderArgs);
5945 }
5946 else {
5947 cacheResult(list);
5948
5949 FinderCacheUtil.putResult(finderPath, finderArgs, list);
5950 }
5951
5952 closeSession(session);
5953 }
5954 }
5955
5956 return list;
5957 }
5958
5959
5969 public JournalArticle findByG_A_First(long groupId, String articleId,
5970 OrderByComparator orderByComparator)
5971 throws NoSuchArticleException, SystemException {
5972 JournalArticle journalArticle = fetchByG_A_First(groupId, articleId,
5973 orderByComparator);
5974
5975 if (journalArticle != null) {
5976 return journalArticle;
5977 }
5978
5979 StringBundler msg = new StringBundler(6);
5980
5981 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5982
5983 msg.append("groupId=");
5984 msg.append(groupId);
5985
5986 msg.append(", articleId=");
5987 msg.append(articleId);
5988
5989 msg.append(StringPool.CLOSE_CURLY_BRACE);
5990
5991 throw new NoSuchArticleException(msg.toString());
5992 }
5993
5994
6003 public JournalArticle fetchByG_A_First(long groupId, String articleId,
6004 OrderByComparator orderByComparator) throws SystemException {
6005 List<JournalArticle> list = findByG_A(groupId, articleId, 0, 1,
6006 orderByComparator);
6007
6008 if (!list.isEmpty()) {
6009 return list.get(0);
6010 }
6011
6012 return null;
6013 }
6014
6015
6025 public JournalArticle findByG_A_Last(long groupId, String articleId,
6026 OrderByComparator orderByComparator)
6027 throws NoSuchArticleException, SystemException {
6028 JournalArticle journalArticle = fetchByG_A_Last(groupId, articleId,
6029 orderByComparator);
6030
6031 if (journalArticle != null) {
6032 return journalArticle;
6033 }
6034
6035 StringBundler msg = new StringBundler(6);
6036
6037 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6038
6039 msg.append("groupId=");
6040 msg.append(groupId);
6041
6042 msg.append(", articleId=");
6043 msg.append(articleId);
6044
6045 msg.append(StringPool.CLOSE_CURLY_BRACE);
6046
6047 throw new NoSuchArticleException(msg.toString());
6048 }
6049
6050
6059 public JournalArticle fetchByG_A_Last(long groupId, String articleId,
6060 OrderByComparator orderByComparator) throws SystemException {
6061 int count = countByG_A(groupId, articleId);
6062
6063 List<JournalArticle> list = findByG_A(groupId, articleId, count - 1,
6064 count, orderByComparator);
6065
6066 if (!list.isEmpty()) {
6067 return list.get(0);
6068 }
6069
6070 return null;
6071 }
6072
6073
6084 public JournalArticle[] findByG_A_PrevAndNext(long id, long groupId,
6085 String articleId, OrderByComparator orderByComparator)
6086 throws NoSuchArticleException, SystemException {
6087 JournalArticle journalArticle = findByPrimaryKey(id);
6088
6089 Session session = null;
6090
6091 try {
6092 session = openSession();
6093
6094 JournalArticle[] array = new JournalArticleImpl[3];
6095
6096 array[0] = getByG_A_PrevAndNext(session, journalArticle, groupId,
6097 articleId, orderByComparator, true);
6098
6099 array[1] = journalArticle;
6100
6101 array[2] = getByG_A_PrevAndNext(session, journalArticle, groupId,
6102 articleId, orderByComparator, false);
6103
6104 return array;
6105 }
6106 catch (Exception e) {
6107 throw processException(e);
6108 }
6109 finally {
6110 closeSession(session);
6111 }
6112 }
6113
6114 protected JournalArticle getByG_A_PrevAndNext(Session session,
6115 JournalArticle journalArticle, long groupId, String articleId,
6116 OrderByComparator orderByComparator, boolean previous) {
6117 StringBundler query = null;
6118
6119 if (orderByComparator != null) {
6120 query = new StringBundler(6 +
6121 (orderByComparator.getOrderByFields().length * 6));
6122 }
6123 else {
6124 query = new StringBundler(3);
6125 }
6126
6127 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
6128
6129 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
6130
6131 if (articleId == null) {
6132 query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
6133 }
6134 else {
6135 if (articleId.equals(StringPool.BLANK)) {
6136 query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
6137 }
6138 else {
6139 query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
6140 }
6141 }
6142
6143 if (orderByComparator != null) {
6144 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
6145
6146 if (orderByConditionFields.length > 0) {
6147 query.append(WHERE_AND);
6148 }
6149
6150 for (int i = 0; i < orderByConditionFields.length; i++) {
6151 query.append(_ORDER_BY_ENTITY_ALIAS);
6152 query.append(orderByConditionFields[i]);
6153
6154 if ((i + 1) < orderByConditionFields.length) {
6155 if (orderByComparator.isAscending() ^ previous) {
6156 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6157 }
6158 else {
6159 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6160 }
6161 }
6162 else {
6163 if (orderByComparator.isAscending() ^ previous) {
6164 query.append(WHERE_GREATER_THAN);
6165 }
6166 else {
6167 query.append(WHERE_LESSER_THAN);
6168 }
6169 }
6170 }
6171
6172 query.append(ORDER_BY_CLAUSE);
6173
6174 String[] orderByFields = orderByComparator.getOrderByFields();
6175
6176 for (int i = 0; i < orderByFields.length; i++) {
6177 query.append(_ORDER_BY_ENTITY_ALIAS);
6178 query.append(orderByFields[i]);
6179
6180 if ((i + 1) < orderByFields.length) {
6181 if (orderByComparator.isAscending() ^ previous) {
6182 query.append(ORDER_BY_ASC_HAS_NEXT);
6183 }
6184 else {
6185 query.append(ORDER_BY_DESC_HAS_NEXT);
6186 }
6187 }
6188 else {
6189 if (orderByComparator.isAscending() ^ previous) {
6190 query.append(ORDER_BY_ASC);
6191 }
6192 else {
6193 query.append(ORDER_BY_DESC);
6194 }
6195 }
6196 }
6197 }
6198
6199 else {
6200 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
6201 }
6202
6203 String sql = query.toString();
6204
6205 Query q = session.createQuery(sql);
6206
6207 q.setFirstResult(0);
6208 q.setMaxResults(2);
6209
6210 QueryPos qPos = QueryPos.getInstance(q);
6211
6212 qPos.add(groupId);
6213
6214 if (articleId != null) {
6215 qPos.add(articleId);
6216 }
6217
6218 if (orderByComparator != null) {
6219 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
6220
6221 for (Object value : values) {
6222 qPos.add(value);
6223 }
6224 }
6225
6226 List<JournalArticle> list = q.list();
6227
6228 if (list.size() == 2) {
6229 return list.get(1);
6230 }
6231 else {
6232 return null;
6233 }
6234 }
6235
6236
6244 public List<JournalArticle> filterFindByG_A(long groupId, String articleId)
6245 throws SystemException {
6246 return filterFindByG_A(groupId, articleId, QueryUtil.ALL_POS,
6247 QueryUtil.ALL_POS, null);
6248 }
6249
6250
6264 public List<JournalArticle> filterFindByG_A(long groupId, String articleId,
6265 int start, int end) throws SystemException {
6266 return filterFindByG_A(groupId, articleId, start, end, null);
6267 }
6268
6269
6284 public List<JournalArticle> filterFindByG_A(long groupId, String articleId,
6285 int start, int end, OrderByComparator orderByComparator)
6286 throws SystemException {
6287 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
6288 return findByG_A(groupId, articleId, start, end, orderByComparator);
6289 }
6290
6291 StringBundler query = null;
6292
6293 if (orderByComparator != null) {
6294 query = new StringBundler(4 +
6295 (orderByComparator.getOrderByFields().length * 3));
6296 }
6297 else {
6298 query = new StringBundler(4);
6299 }
6300
6301 if (getDB().isSupportsInlineDistinct()) {
6302 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
6303 }
6304 else {
6305 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
6306 }
6307
6308 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
6309
6310 if (articleId == null) {
6311 query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
6312 }
6313 else {
6314 if (articleId.equals(StringPool.BLANK)) {
6315 query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
6316 }
6317 else {
6318 query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
6319 }
6320 }
6321
6322 if (!getDB().isSupportsInlineDistinct()) {
6323 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
6324 }
6325
6326 if (orderByComparator != null) {
6327 if (getDB().isSupportsInlineDistinct()) {
6328 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6329 orderByComparator);
6330 }
6331 else {
6332 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
6333 orderByComparator);
6334 }
6335 }
6336
6337 else {
6338 if (getDB().isSupportsInlineDistinct()) {
6339 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
6340 }
6341 else {
6342 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
6343 }
6344 }
6345
6346 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
6347 JournalArticle.class.getName(),
6348 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
6349
6350 Session session = null;
6351
6352 try {
6353 session = openSession();
6354
6355 SQLQuery q = session.createSQLQuery(sql);
6356
6357 if (getDB().isSupportsInlineDistinct()) {
6358 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
6359 }
6360 else {
6361 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
6362 }
6363
6364 QueryPos qPos = QueryPos.getInstance(q);
6365
6366 qPos.add(groupId);
6367
6368 if (articleId != null) {
6369 qPos.add(articleId);
6370 }
6371
6372 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
6373 end);
6374 }
6375 catch (Exception e) {
6376 throw processException(e);
6377 }
6378 finally {
6379 closeSession(session);
6380 }
6381 }
6382
6383
6394 public JournalArticle[] filterFindByG_A_PrevAndNext(long id, long groupId,
6395 String articleId, OrderByComparator orderByComparator)
6396 throws NoSuchArticleException, SystemException {
6397 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
6398 return findByG_A_PrevAndNext(id, groupId, articleId,
6399 orderByComparator);
6400 }
6401
6402 JournalArticle journalArticle = findByPrimaryKey(id);
6403
6404 Session session = null;
6405
6406 try {
6407 session = openSession();
6408
6409 JournalArticle[] array = new JournalArticleImpl[3];
6410
6411 array[0] = filterGetByG_A_PrevAndNext(session, journalArticle,
6412 groupId, articleId, orderByComparator, true);
6413
6414 array[1] = journalArticle;
6415
6416 array[2] = filterGetByG_A_PrevAndNext(session, journalArticle,
6417 groupId, articleId, orderByComparator, false);
6418
6419 return array;
6420 }
6421 catch (Exception e) {
6422 throw processException(e);
6423 }
6424 finally {
6425 closeSession(session);
6426 }
6427 }
6428
6429 protected JournalArticle filterGetByG_A_PrevAndNext(Session session,
6430 JournalArticle journalArticle, long groupId, String articleId,
6431 OrderByComparator orderByComparator, boolean previous) {
6432 StringBundler query = null;
6433
6434 if (orderByComparator != null) {
6435 query = new StringBundler(6 +
6436 (orderByComparator.getOrderByFields().length * 6));
6437 }
6438 else {
6439 query = new StringBundler(3);
6440 }
6441
6442 if (getDB().isSupportsInlineDistinct()) {
6443 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
6444 }
6445 else {
6446 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
6447 }
6448
6449 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
6450
6451 if (articleId == null) {
6452 query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
6453 }
6454 else {
6455 if (articleId.equals(StringPool.BLANK)) {
6456 query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
6457 }
6458 else {
6459 query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
6460 }
6461 }
6462
6463 if (!getDB().isSupportsInlineDistinct()) {
6464 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
6465 }
6466
6467 if (orderByComparator != null) {
6468 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
6469
6470 if (orderByConditionFields.length > 0) {
6471 query.append(WHERE_AND);
6472 }
6473
6474 for (int i = 0; i < orderByConditionFields.length; i++) {
6475 if (getDB().isSupportsInlineDistinct()) {
6476 query.append(_ORDER_BY_ENTITY_ALIAS);
6477 }
6478 else {
6479 query.append(_ORDER_BY_ENTITY_TABLE);
6480 }
6481
6482 query.append(orderByConditionFields[i]);
6483
6484 if ((i + 1) < orderByConditionFields.length) {
6485 if (orderByComparator.isAscending() ^ previous) {
6486 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6487 }
6488 else {
6489 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6490 }
6491 }
6492 else {
6493 if (orderByComparator.isAscending() ^ previous) {
6494 query.append(WHERE_GREATER_THAN);
6495 }
6496 else {
6497 query.append(WHERE_LESSER_THAN);
6498 }
6499 }
6500 }
6501
6502 query.append(ORDER_BY_CLAUSE);
6503
6504 String[] orderByFields = orderByComparator.getOrderByFields();
6505
6506 for (int i = 0; i < orderByFields.length; i++) {
6507 if (getDB().isSupportsInlineDistinct()) {
6508 query.append(_ORDER_BY_ENTITY_ALIAS);
6509 }
6510 else {
6511 query.append(_ORDER_BY_ENTITY_TABLE);
6512 }
6513
6514 query.append(orderByFields[i]);
6515
6516 if ((i + 1) < orderByFields.length) {
6517 if (orderByComparator.isAscending() ^ previous) {
6518 query.append(ORDER_BY_ASC_HAS_NEXT);
6519 }
6520 else {
6521 query.append(ORDER_BY_DESC_HAS_NEXT);
6522 }
6523 }
6524 else {
6525 if (orderByComparator.isAscending() ^ previous) {
6526 query.append(ORDER_BY_ASC);
6527 }
6528 else {
6529 query.append(ORDER_BY_DESC);
6530 }
6531 }
6532 }
6533 }
6534
6535 else {
6536 if (getDB().isSupportsInlineDistinct()) {
6537 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
6538 }
6539 else {
6540 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
6541 }
6542 }
6543
6544 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
6545 JournalArticle.class.getName(),
6546 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
6547
6548 SQLQuery q = session.createSQLQuery(sql);
6549
6550 q.setFirstResult(0);
6551 q.setMaxResults(2);
6552
6553 if (getDB().isSupportsInlineDistinct()) {
6554 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
6555 }
6556 else {
6557 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
6558 }
6559
6560 QueryPos qPos = QueryPos.getInstance(q);
6561
6562 qPos.add(groupId);
6563
6564 if (articleId != null) {
6565 qPos.add(articleId);
6566 }
6567
6568 if (orderByComparator != null) {
6569 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
6570
6571 for (Object value : values) {
6572 qPos.add(value);
6573 }
6574 }
6575
6576 List<JournalArticle> list = q.list();
6577
6578 if (list.size() == 2) {
6579 return list.get(1);
6580 }
6581 else {
6582 return null;
6583 }
6584 }
6585
6586
6594 public List<JournalArticle> findByG_UT(long groupId, String urlTitle)
6595 throws SystemException {
6596 return findByG_UT(groupId, urlTitle, QueryUtil.ALL_POS,
6597 QueryUtil.ALL_POS, null);
6598 }
6599
6600
6614 public List<JournalArticle> findByG_UT(long groupId, String urlTitle,
6615 int start, int end) throws SystemException {
6616 return findByG_UT(groupId, urlTitle, start, end, null);
6617 }
6618
6619
6634 public List<JournalArticle> findByG_UT(long groupId, String urlTitle,
6635 int start, int end, OrderByComparator orderByComparator)
6636 throws SystemException {
6637 FinderPath finderPath = null;
6638 Object[] finderArgs = null;
6639
6640 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
6641 (orderByComparator == null)) {
6642 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT;
6643 finderArgs = new Object[] { groupId, urlTitle };
6644 }
6645 else {
6646 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_UT;
6647 finderArgs = new Object[] {
6648 groupId, urlTitle,
6649
6650 start, end, orderByComparator
6651 };
6652 }
6653
6654 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
6655 finderArgs, this);
6656
6657 if ((list != null) && !list.isEmpty()) {
6658 for (JournalArticle journalArticle : list) {
6659 if ((groupId != journalArticle.getGroupId()) ||
6660 !Validator.equals(urlTitle, journalArticle.getUrlTitle())) {
6661 list = null;
6662
6663 break;
6664 }
6665 }
6666 }
6667
6668 if (list == null) {
6669 StringBundler query = null;
6670
6671 if (orderByComparator != null) {
6672 query = new StringBundler(4 +
6673 (orderByComparator.getOrderByFields().length * 3));
6674 }
6675 else {
6676 query = new StringBundler(4);
6677 }
6678
6679 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
6680
6681 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
6682
6683 if (urlTitle == null) {
6684 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
6685 }
6686 else {
6687 if (urlTitle.equals(StringPool.BLANK)) {
6688 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
6689 }
6690 else {
6691 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
6692 }
6693 }
6694
6695 if (orderByComparator != null) {
6696 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6697 orderByComparator);
6698 }
6699
6700 else {
6701 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
6702 }
6703
6704 String sql = query.toString();
6705
6706 Session session = null;
6707
6708 try {
6709 session = openSession();
6710
6711 Query q = session.createQuery(sql);
6712
6713 QueryPos qPos = QueryPos.getInstance(q);
6714
6715 qPos.add(groupId);
6716
6717 if (urlTitle != null) {
6718 qPos.add(urlTitle);
6719 }
6720
6721 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
6722 start, end);
6723 }
6724 catch (Exception e) {
6725 throw processException(e);
6726 }
6727 finally {
6728 if (list == null) {
6729 FinderCacheUtil.removeResult(finderPath, finderArgs);
6730 }
6731 else {
6732 cacheResult(list);
6733
6734 FinderCacheUtil.putResult(finderPath, finderArgs, list);
6735 }
6736
6737 closeSession(session);
6738 }
6739 }
6740
6741 return list;
6742 }
6743
6744
6754 public JournalArticle findByG_UT_First(long groupId, String urlTitle,
6755 OrderByComparator orderByComparator)
6756 throws NoSuchArticleException, SystemException {
6757 JournalArticle journalArticle = fetchByG_UT_First(groupId, urlTitle,
6758 orderByComparator);
6759
6760 if (journalArticle != null) {
6761 return journalArticle;
6762 }
6763
6764 StringBundler msg = new StringBundler(6);
6765
6766 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6767
6768 msg.append("groupId=");
6769 msg.append(groupId);
6770
6771 msg.append(", urlTitle=");
6772 msg.append(urlTitle);
6773
6774 msg.append(StringPool.CLOSE_CURLY_BRACE);
6775
6776 throw new NoSuchArticleException(msg.toString());
6777 }
6778
6779
6788 public JournalArticle fetchByG_UT_First(long groupId, String urlTitle,
6789 OrderByComparator orderByComparator) throws SystemException {
6790 List<JournalArticle> list = findByG_UT(groupId, urlTitle, 0, 1,
6791 orderByComparator);
6792
6793 if (!list.isEmpty()) {
6794 return list.get(0);
6795 }
6796
6797 return null;
6798 }
6799
6800
6810 public JournalArticle findByG_UT_Last(long groupId, String urlTitle,
6811 OrderByComparator orderByComparator)
6812 throws NoSuchArticleException, SystemException {
6813 JournalArticle journalArticle = fetchByG_UT_Last(groupId, urlTitle,
6814 orderByComparator);
6815
6816 if (journalArticle != null) {
6817 return journalArticle;
6818 }
6819
6820 StringBundler msg = new StringBundler(6);
6821
6822 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6823
6824 msg.append("groupId=");
6825 msg.append(groupId);
6826
6827 msg.append(", urlTitle=");
6828 msg.append(urlTitle);
6829
6830 msg.append(StringPool.CLOSE_CURLY_BRACE);
6831
6832 throw new NoSuchArticleException(msg.toString());
6833 }
6834
6835
6844 public JournalArticle fetchByG_UT_Last(long groupId, String urlTitle,
6845 OrderByComparator orderByComparator) throws SystemException {
6846 int count = countByG_UT(groupId, urlTitle);
6847
6848 List<JournalArticle> list = findByG_UT(groupId, urlTitle, count - 1,
6849 count, orderByComparator);
6850
6851 if (!list.isEmpty()) {
6852 return list.get(0);
6853 }
6854
6855 return null;
6856 }
6857
6858
6869 public JournalArticle[] findByG_UT_PrevAndNext(long id, long groupId,
6870 String urlTitle, OrderByComparator orderByComparator)
6871 throws NoSuchArticleException, SystemException {
6872 JournalArticle journalArticle = findByPrimaryKey(id);
6873
6874 Session session = null;
6875
6876 try {
6877 session = openSession();
6878
6879 JournalArticle[] array = new JournalArticleImpl[3];
6880
6881 array[0] = getByG_UT_PrevAndNext(session, journalArticle, groupId,
6882 urlTitle, orderByComparator, true);
6883
6884 array[1] = journalArticle;
6885
6886 array[2] = getByG_UT_PrevAndNext(session, journalArticle, groupId,
6887 urlTitle, orderByComparator, false);
6888
6889 return array;
6890 }
6891 catch (Exception e) {
6892 throw processException(e);
6893 }
6894 finally {
6895 closeSession(session);
6896 }
6897 }
6898
6899 protected JournalArticle getByG_UT_PrevAndNext(Session session,
6900 JournalArticle journalArticle, long groupId, String urlTitle,
6901 OrderByComparator orderByComparator, boolean previous) {
6902 StringBundler query = null;
6903
6904 if (orderByComparator != null) {
6905 query = new StringBundler(6 +
6906 (orderByComparator.getOrderByFields().length * 6));
6907 }
6908 else {
6909 query = new StringBundler(3);
6910 }
6911
6912 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
6913
6914 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
6915
6916 if (urlTitle == null) {
6917 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
6918 }
6919 else {
6920 if (urlTitle.equals(StringPool.BLANK)) {
6921 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
6922 }
6923 else {
6924 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
6925 }
6926 }
6927
6928 if (orderByComparator != null) {
6929 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
6930
6931 if (orderByConditionFields.length > 0) {
6932 query.append(WHERE_AND);
6933 }
6934
6935 for (int i = 0; i < orderByConditionFields.length; i++) {
6936 query.append(_ORDER_BY_ENTITY_ALIAS);
6937 query.append(orderByConditionFields[i]);
6938
6939 if ((i + 1) < orderByConditionFields.length) {
6940 if (orderByComparator.isAscending() ^ previous) {
6941 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6942 }
6943 else {
6944 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6945 }
6946 }
6947 else {
6948 if (orderByComparator.isAscending() ^ previous) {
6949 query.append(WHERE_GREATER_THAN);
6950 }
6951 else {
6952 query.append(WHERE_LESSER_THAN);
6953 }
6954 }
6955 }
6956
6957 query.append(ORDER_BY_CLAUSE);
6958
6959 String[] orderByFields = orderByComparator.getOrderByFields();
6960
6961 for (int i = 0; i < orderByFields.length; i++) {
6962 query.append(_ORDER_BY_ENTITY_ALIAS);
6963 query.append(orderByFields[i]);
6964
6965 if ((i + 1) < orderByFields.length) {
6966 if (orderByComparator.isAscending() ^ previous) {
6967 query.append(ORDER_BY_ASC_HAS_NEXT);
6968 }
6969 else {
6970 query.append(ORDER_BY_DESC_HAS_NEXT);
6971 }
6972 }
6973 else {
6974 if (orderByComparator.isAscending() ^ previous) {
6975 query.append(ORDER_BY_ASC);
6976 }
6977 else {
6978 query.append(ORDER_BY_DESC);
6979 }
6980 }
6981 }
6982 }
6983
6984 else {
6985 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
6986 }
6987
6988 String sql = query.toString();
6989
6990 Query q = session.createQuery(sql);
6991
6992 q.setFirstResult(0);
6993 q.setMaxResults(2);
6994
6995 QueryPos qPos = QueryPos.getInstance(q);
6996
6997 qPos.add(groupId);
6998
6999 if (urlTitle != null) {
7000 qPos.add(urlTitle);
7001 }
7002
7003 if (orderByComparator != null) {
7004 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
7005
7006 for (Object value : values) {
7007 qPos.add(value);
7008 }
7009 }
7010
7011 List<JournalArticle> list = q.list();
7012
7013 if (list.size() == 2) {
7014 return list.get(1);
7015 }
7016 else {
7017 return null;
7018 }
7019 }
7020
7021
7029 public List<JournalArticle> filterFindByG_UT(long groupId, String urlTitle)
7030 throws SystemException {
7031 return filterFindByG_UT(groupId, urlTitle, QueryUtil.ALL_POS,
7032 QueryUtil.ALL_POS, null);
7033 }
7034
7035
7049 public List<JournalArticle> filterFindByG_UT(long groupId, String urlTitle,
7050 int start, int end) throws SystemException {
7051 return filterFindByG_UT(groupId, urlTitle, start, end, null);
7052 }
7053
7054
7069 public List<JournalArticle> filterFindByG_UT(long groupId, String urlTitle,
7070 int start, int end, OrderByComparator orderByComparator)
7071 throws SystemException {
7072 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7073 return findByG_UT(groupId, urlTitle, start, end, orderByComparator);
7074 }
7075
7076 StringBundler query = null;
7077
7078 if (orderByComparator != null) {
7079 query = new StringBundler(4 +
7080 (orderByComparator.getOrderByFields().length * 3));
7081 }
7082 else {
7083 query = new StringBundler(4);
7084 }
7085
7086 if (getDB().isSupportsInlineDistinct()) {
7087 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
7088 }
7089 else {
7090 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
7091 }
7092
7093 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
7094
7095 if (urlTitle == null) {
7096 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
7097 }
7098 else {
7099 if (urlTitle.equals(StringPool.BLANK)) {
7100 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
7101 }
7102 else {
7103 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
7104 }
7105 }
7106
7107 if (!getDB().isSupportsInlineDistinct()) {
7108 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
7109 }
7110
7111 if (orderByComparator != null) {
7112 if (getDB().isSupportsInlineDistinct()) {
7113 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7114 orderByComparator);
7115 }
7116 else {
7117 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
7118 orderByComparator);
7119 }
7120 }
7121
7122 else {
7123 if (getDB().isSupportsInlineDistinct()) {
7124 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
7125 }
7126 else {
7127 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
7128 }
7129 }
7130
7131 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7132 JournalArticle.class.getName(),
7133 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7134
7135 Session session = null;
7136
7137 try {
7138 session = openSession();
7139
7140 SQLQuery q = session.createSQLQuery(sql);
7141
7142 if (getDB().isSupportsInlineDistinct()) {
7143 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
7144 }
7145 else {
7146 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
7147 }
7148
7149 QueryPos qPos = QueryPos.getInstance(q);
7150
7151 qPos.add(groupId);
7152
7153 if (urlTitle != null) {
7154 qPos.add(urlTitle);
7155 }
7156
7157 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
7158 end);
7159 }
7160 catch (Exception e) {
7161 throw processException(e);
7162 }
7163 finally {
7164 closeSession(session);
7165 }
7166 }
7167
7168
7179 public JournalArticle[] filterFindByG_UT_PrevAndNext(long id, long groupId,
7180 String urlTitle, OrderByComparator orderByComparator)
7181 throws NoSuchArticleException, SystemException {
7182 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7183 return findByG_UT_PrevAndNext(id, groupId, urlTitle,
7184 orderByComparator);
7185 }
7186
7187 JournalArticle journalArticle = findByPrimaryKey(id);
7188
7189 Session session = null;
7190
7191 try {
7192 session = openSession();
7193
7194 JournalArticle[] array = new JournalArticleImpl[3];
7195
7196 array[0] = filterGetByG_UT_PrevAndNext(session, journalArticle,
7197 groupId, urlTitle, orderByComparator, true);
7198
7199 array[1] = journalArticle;
7200
7201 array[2] = filterGetByG_UT_PrevAndNext(session, journalArticle,
7202 groupId, urlTitle, orderByComparator, false);
7203
7204 return array;
7205 }
7206 catch (Exception e) {
7207 throw processException(e);
7208 }
7209 finally {
7210 closeSession(session);
7211 }
7212 }
7213
7214 protected JournalArticle filterGetByG_UT_PrevAndNext(Session session,
7215 JournalArticle journalArticle, long groupId, String urlTitle,
7216 OrderByComparator orderByComparator, boolean previous) {
7217 StringBundler query = null;
7218
7219 if (orderByComparator != null) {
7220 query = new StringBundler(6 +
7221 (orderByComparator.getOrderByFields().length * 6));
7222 }
7223 else {
7224 query = new StringBundler(3);
7225 }
7226
7227 if (getDB().isSupportsInlineDistinct()) {
7228 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
7229 }
7230 else {
7231 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
7232 }
7233
7234 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
7235
7236 if (urlTitle == null) {
7237 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
7238 }
7239 else {
7240 if (urlTitle.equals(StringPool.BLANK)) {
7241 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
7242 }
7243 else {
7244 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
7245 }
7246 }
7247
7248 if (!getDB().isSupportsInlineDistinct()) {
7249 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
7250 }
7251
7252 if (orderByComparator != null) {
7253 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
7254
7255 if (orderByConditionFields.length > 0) {
7256 query.append(WHERE_AND);
7257 }
7258
7259 for (int i = 0; i < orderByConditionFields.length; i++) {
7260 if (getDB().isSupportsInlineDistinct()) {
7261 query.append(_ORDER_BY_ENTITY_ALIAS);
7262 }
7263 else {
7264 query.append(_ORDER_BY_ENTITY_TABLE);
7265 }
7266
7267 query.append(orderByConditionFields[i]);
7268
7269 if ((i + 1) < orderByConditionFields.length) {
7270 if (orderByComparator.isAscending() ^ previous) {
7271 query.append(WHERE_GREATER_THAN_HAS_NEXT);
7272 }
7273 else {
7274 query.append(WHERE_LESSER_THAN_HAS_NEXT);
7275 }
7276 }
7277 else {
7278 if (orderByComparator.isAscending() ^ previous) {
7279 query.append(WHERE_GREATER_THAN);
7280 }
7281 else {
7282 query.append(WHERE_LESSER_THAN);
7283 }
7284 }
7285 }
7286
7287 query.append(ORDER_BY_CLAUSE);
7288
7289 String[] orderByFields = orderByComparator.getOrderByFields();
7290
7291 for (int i = 0; i < orderByFields.length; i++) {
7292 if (getDB().isSupportsInlineDistinct()) {
7293 query.append(_ORDER_BY_ENTITY_ALIAS);
7294 }
7295 else {
7296 query.append(_ORDER_BY_ENTITY_TABLE);
7297 }
7298
7299 query.append(orderByFields[i]);
7300
7301 if ((i + 1) < orderByFields.length) {
7302 if (orderByComparator.isAscending() ^ previous) {
7303 query.append(ORDER_BY_ASC_HAS_NEXT);
7304 }
7305 else {
7306 query.append(ORDER_BY_DESC_HAS_NEXT);
7307 }
7308 }
7309 else {
7310 if (orderByComparator.isAscending() ^ previous) {
7311 query.append(ORDER_BY_ASC);
7312 }
7313 else {
7314 query.append(ORDER_BY_DESC);
7315 }
7316 }
7317 }
7318 }
7319
7320 else {
7321 if (getDB().isSupportsInlineDistinct()) {
7322 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
7323 }
7324 else {
7325 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
7326 }
7327 }
7328
7329 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7330 JournalArticle.class.getName(),
7331 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7332
7333 SQLQuery q = session.createSQLQuery(sql);
7334
7335 q.setFirstResult(0);
7336 q.setMaxResults(2);
7337
7338 if (getDB().isSupportsInlineDistinct()) {
7339 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
7340 }
7341 else {
7342 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
7343 }
7344
7345 QueryPos qPos = QueryPos.getInstance(q);
7346
7347 qPos.add(groupId);
7348
7349 if (urlTitle != null) {
7350 qPos.add(urlTitle);
7351 }
7352
7353 if (orderByComparator != null) {
7354 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
7355
7356 for (Object value : values) {
7357 qPos.add(value);
7358 }
7359 }
7360
7361 List<JournalArticle> list = q.list();
7362
7363 if (list.size() == 2) {
7364 return list.get(1);
7365 }
7366 else {
7367 return null;
7368 }
7369 }
7370
7371
7379 public List<JournalArticle> findByG_S(long groupId, String structureId)
7380 throws SystemException {
7381 return findByG_S(groupId, structureId, QueryUtil.ALL_POS,
7382 QueryUtil.ALL_POS, null);
7383 }
7384
7385
7399 public List<JournalArticle> findByG_S(long groupId, String structureId,
7400 int start, int end) throws SystemException {
7401 return findByG_S(groupId, structureId, start, end, null);
7402 }
7403
7404
7419 public List<JournalArticle> findByG_S(long groupId, String structureId,
7420 int start, int end, OrderByComparator orderByComparator)
7421 throws SystemException {
7422 FinderPath finderPath = null;
7423 Object[] finderArgs = null;
7424
7425 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
7426 (orderByComparator == null)) {
7427 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S;
7428 finderArgs = new Object[] { groupId, structureId };
7429 }
7430 else {
7431 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S;
7432 finderArgs = new Object[] {
7433 groupId, structureId,
7434
7435 start, end, orderByComparator
7436 };
7437 }
7438
7439 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
7440 finderArgs, this);
7441
7442 if ((list != null) && !list.isEmpty()) {
7443 for (JournalArticle journalArticle : list) {
7444 if ((groupId != journalArticle.getGroupId()) ||
7445 !Validator.equals(structureId,
7446 journalArticle.getStructureId())) {
7447 list = null;
7448
7449 break;
7450 }
7451 }
7452 }
7453
7454 if (list == null) {
7455 StringBundler query = null;
7456
7457 if (orderByComparator != null) {
7458 query = new StringBundler(4 +
7459 (orderByComparator.getOrderByFields().length * 3));
7460 }
7461 else {
7462 query = new StringBundler(4);
7463 }
7464
7465 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
7466
7467 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
7468
7469 if (structureId == null) {
7470 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
7471 }
7472 else {
7473 if (structureId.equals(StringPool.BLANK)) {
7474 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
7475 }
7476 else {
7477 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
7478 }
7479 }
7480
7481 if (orderByComparator != null) {
7482 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7483 orderByComparator);
7484 }
7485
7486 else {
7487 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
7488 }
7489
7490 String sql = query.toString();
7491
7492 Session session = null;
7493
7494 try {
7495 session = openSession();
7496
7497 Query q = session.createQuery(sql);
7498
7499 QueryPos qPos = QueryPos.getInstance(q);
7500
7501 qPos.add(groupId);
7502
7503 if (structureId != null) {
7504 qPos.add(structureId);
7505 }
7506
7507 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
7508 start, end);
7509 }
7510 catch (Exception e) {
7511 throw processException(e);
7512 }
7513 finally {
7514 if (list == null) {
7515 FinderCacheUtil.removeResult(finderPath, finderArgs);
7516 }
7517 else {
7518 cacheResult(list);
7519
7520 FinderCacheUtil.putResult(finderPath, finderArgs, list);
7521 }
7522
7523 closeSession(session);
7524 }
7525 }
7526
7527 return list;
7528 }
7529
7530
7540 public JournalArticle findByG_S_First(long groupId, String structureId,
7541 OrderByComparator orderByComparator)
7542 throws NoSuchArticleException, SystemException {
7543 JournalArticle journalArticle = fetchByG_S_First(groupId, structureId,
7544 orderByComparator);
7545
7546 if (journalArticle != null) {
7547 return journalArticle;
7548 }
7549
7550 StringBundler msg = new StringBundler(6);
7551
7552 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7553
7554 msg.append("groupId=");
7555 msg.append(groupId);
7556
7557 msg.append(", structureId=");
7558 msg.append(structureId);
7559
7560 msg.append(StringPool.CLOSE_CURLY_BRACE);
7561
7562 throw new NoSuchArticleException(msg.toString());
7563 }
7564
7565
7574 public JournalArticle fetchByG_S_First(long groupId, String structureId,
7575 OrderByComparator orderByComparator) throws SystemException {
7576 List<JournalArticle> list = findByG_S(groupId, structureId, 0, 1,
7577 orderByComparator);
7578
7579 if (!list.isEmpty()) {
7580 return list.get(0);
7581 }
7582
7583 return null;
7584 }
7585
7586
7596 public JournalArticle findByG_S_Last(long groupId, String structureId,
7597 OrderByComparator orderByComparator)
7598 throws NoSuchArticleException, SystemException {
7599 JournalArticle journalArticle = fetchByG_S_Last(groupId, structureId,
7600 orderByComparator);
7601
7602 if (journalArticle != null) {
7603 return journalArticle;
7604 }
7605
7606 StringBundler msg = new StringBundler(6);
7607
7608 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7609
7610 msg.append("groupId=");
7611 msg.append(groupId);
7612
7613 msg.append(", structureId=");
7614 msg.append(structureId);
7615
7616 msg.append(StringPool.CLOSE_CURLY_BRACE);
7617
7618 throw new NoSuchArticleException(msg.toString());
7619 }
7620
7621
7630 public JournalArticle fetchByG_S_Last(long groupId, String structureId,
7631 OrderByComparator orderByComparator) throws SystemException {
7632 int count = countByG_S(groupId, structureId);
7633
7634 List<JournalArticle> list = findByG_S(groupId, structureId, count - 1,
7635 count, orderByComparator);
7636
7637 if (!list.isEmpty()) {
7638 return list.get(0);
7639 }
7640
7641 return null;
7642 }
7643
7644
7655 public JournalArticle[] findByG_S_PrevAndNext(long id, long groupId,
7656 String structureId, OrderByComparator orderByComparator)
7657 throws NoSuchArticleException, SystemException {
7658 JournalArticle journalArticle = findByPrimaryKey(id);
7659
7660 Session session = null;
7661
7662 try {
7663 session = openSession();
7664
7665 JournalArticle[] array = new JournalArticleImpl[3];
7666
7667 array[0] = getByG_S_PrevAndNext(session, journalArticle, groupId,
7668 structureId, orderByComparator, true);
7669
7670 array[1] = journalArticle;
7671
7672 array[2] = getByG_S_PrevAndNext(session, journalArticle, groupId,
7673 structureId, orderByComparator, false);
7674
7675 return array;
7676 }
7677 catch (Exception e) {
7678 throw processException(e);
7679 }
7680 finally {
7681 closeSession(session);
7682 }
7683 }
7684
7685 protected JournalArticle getByG_S_PrevAndNext(Session session,
7686 JournalArticle journalArticle, long groupId, String structureId,
7687 OrderByComparator orderByComparator, boolean previous) {
7688 StringBundler query = null;
7689
7690 if (orderByComparator != null) {
7691 query = new StringBundler(6 +
7692 (orderByComparator.getOrderByFields().length * 6));
7693 }
7694 else {
7695 query = new StringBundler(3);
7696 }
7697
7698 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
7699
7700 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
7701
7702 if (structureId == null) {
7703 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
7704 }
7705 else {
7706 if (structureId.equals(StringPool.BLANK)) {
7707 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
7708 }
7709 else {
7710 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
7711 }
7712 }
7713
7714 if (orderByComparator != null) {
7715 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
7716
7717 if (orderByConditionFields.length > 0) {
7718 query.append(WHERE_AND);
7719 }
7720
7721 for (int i = 0; i < orderByConditionFields.length; i++) {
7722 query.append(_ORDER_BY_ENTITY_ALIAS);
7723 query.append(orderByConditionFields[i]);
7724
7725 if ((i + 1) < orderByConditionFields.length) {
7726 if (orderByComparator.isAscending() ^ previous) {
7727 query.append(WHERE_GREATER_THAN_HAS_NEXT);
7728 }
7729 else {
7730 query.append(WHERE_LESSER_THAN_HAS_NEXT);
7731 }
7732 }
7733 else {
7734 if (orderByComparator.isAscending() ^ previous) {
7735 query.append(WHERE_GREATER_THAN);
7736 }
7737 else {
7738 query.append(WHERE_LESSER_THAN);
7739 }
7740 }
7741 }
7742
7743 query.append(ORDER_BY_CLAUSE);
7744
7745 String[] orderByFields = orderByComparator.getOrderByFields();
7746
7747 for (int i = 0; i < orderByFields.length; i++) {
7748 query.append(_ORDER_BY_ENTITY_ALIAS);
7749 query.append(orderByFields[i]);
7750
7751 if ((i + 1) < orderByFields.length) {
7752 if (orderByComparator.isAscending() ^ previous) {
7753 query.append(ORDER_BY_ASC_HAS_NEXT);
7754 }
7755 else {
7756 query.append(ORDER_BY_DESC_HAS_NEXT);
7757 }
7758 }
7759 else {
7760 if (orderByComparator.isAscending() ^ previous) {
7761 query.append(ORDER_BY_ASC);
7762 }
7763 else {
7764 query.append(ORDER_BY_DESC);
7765 }
7766 }
7767 }
7768 }
7769
7770 else {
7771 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
7772 }
7773
7774 String sql = query.toString();
7775
7776 Query q = session.createQuery(sql);
7777
7778 q.setFirstResult(0);
7779 q.setMaxResults(2);
7780
7781 QueryPos qPos = QueryPos.getInstance(q);
7782
7783 qPos.add(groupId);
7784
7785 if (structureId != null) {
7786 qPos.add(structureId);
7787 }
7788
7789 if (orderByComparator != null) {
7790 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
7791
7792 for (Object value : values) {
7793 qPos.add(value);
7794 }
7795 }
7796
7797 List<JournalArticle> list = q.list();
7798
7799 if (list.size() == 2) {
7800 return list.get(1);
7801 }
7802 else {
7803 return null;
7804 }
7805 }
7806
7807
7815 public List<JournalArticle> filterFindByG_S(long groupId, String structureId)
7816 throws SystemException {
7817 return filterFindByG_S(groupId, structureId, QueryUtil.ALL_POS,
7818 QueryUtil.ALL_POS, null);
7819 }
7820
7821
7835 public List<JournalArticle> filterFindByG_S(long groupId,
7836 String structureId, int start, int end) throws SystemException {
7837 return filterFindByG_S(groupId, structureId, start, end, null);
7838 }
7839
7840
7855 public List<JournalArticle> filterFindByG_S(long groupId,
7856 String structureId, int start, int end,
7857 OrderByComparator orderByComparator) throws SystemException {
7858 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7859 return findByG_S(groupId, structureId, start, end, orderByComparator);
7860 }
7861
7862 StringBundler query = null;
7863
7864 if (orderByComparator != null) {
7865 query = new StringBundler(4 +
7866 (orderByComparator.getOrderByFields().length * 3));
7867 }
7868 else {
7869 query = new StringBundler(4);
7870 }
7871
7872 if (getDB().isSupportsInlineDistinct()) {
7873 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
7874 }
7875 else {
7876 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
7877 }
7878
7879 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
7880
7881 if (structureId == null) {
7882 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
7883 }
7884 else {
7885 if (structureId.equals(StringPool.BLANK)) {
7886 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
7887 }
7888 else {
7889 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
7890 }
7891 }
7892
7893 if (!getDB().isSupportsInlineDistinct()) {
7894 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
7895 }
7896
7897 if (orderByComparator != null) {
7898 if (getDB().isSupportsInlineDistinct()) {
7899 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7900 orderByComparator);
7901 }
7902 else {
7903 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
7904 orderByComparator);
7905 }
7906 }
7907
7908 else {
7909 if (getDB().isSupportsInlineDistinct()) {
7910 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
7911 }
7912 else {
7913 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
7914 }
7915 }
7916
7917 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7918 JournalArticle.class.getName(),
7919 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7920
7921 Session session = null;
7922
7923 try {
7924 session = openSession();
7925
7926 SQLQuery q = session.createSQLQuery(sql);
7927
7928 if (getDB().isSupportsInlineDistinct()) {
7929 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
7930 }
7931 else {
7932 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
7933 }
7934
7935 QueryPos qPos = QueryPos.getInstance(q);
7936
7937 qPos.add(groupId);
7938
7939 if (structureId != null) {
7940 qPos.add(structureId);
7941 }
7942
7943 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
7944 end);
7945 }
7946 catch (Exception e) {
7947 throw processException(e);
7948 }
7949 finally {
7950 closeSession(session);
7951 }
7952 }
7953
7954
7965 public JournalArticle[] filterFindByG_S_PrevAndNext(long id, long groupId,
7966 String structureId, OrderByComparator orderByComparator)
7967 throws NoSuchArticleException, SystemException {
7968 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7969 return findByG_S_PrevAndNext(id, groupId, structureId,
7970 orderByComparator);
7971 }
7972
7973 JournalArticle journalArticle = findByPrimaryKey(id);
7974
7975 Session session = null;
7976
7977 try {
7978 session = openSession();
7979
7980 JournalArticle[] array = new JournalArticleImpl[3];
7981
7982 array[0] = filterGetByG_S_PrevAndNext(session, journalArticle,
7983 groupId, structureId, orderByComparator, true);
7984
7985 array[1] = journalArticle;
7986
7987 array[2] = filterGetByG_S_PrevAndNext(session, journalArticle,
7988 groupId, structureId, orderByComparator, false);
7989
7990 return array;
7991 }
7992 catch (Exception e) {
7993 throw processException(e);
7994 }
7995 finally {
7996 closeSession(session);
7997 }
7998 }
7999
8000 protected JournalArticle filterGetByG_S_PrevAndNext(Session session,
8001 JournalArticle journalArticle, long groupId, String structureId,
8002 OrderByComparator orderByComparator, boolean previous) {
8003 StringBundler query = null;
8004
8005 if (orderByComparator != null) {
8006 query = new StringBundler(6 +
8007 (orderByComparator.getOrderByFields().length * 6));
8008 }
8009 else {
8010 query = new StringBundler(3);
8011 }
8012
8013 if (getDB().isSupportsInlineDistinct()) {
8014 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
8015 }
8016 else {
8017 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
8018 }
8019
8020 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
8021
8022 if (structureId == null) {
8023 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
8024 }
8025 else {
8026 if (structureId.equals(StringPool.BLANK)) {
8027 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
8028 }
8029 else {
8030 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
8031 }
8032 }
8033
8034 if (!getDB().isSupportsInlineDistinct()) {
8035 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
8036 }
8037
8038 if (orderByComparator != null) {
8039 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8040
8041 if (orderByConditionFields.length > 0) {
8042 query.append(WHERE_AND);
8043 }
8044
8045 for (int i = 0; i < orderByConditionFields.length; i++) {
8046 if (getDB().isSupportsInlineDistinct()) {
8047 query.append(_ORDER_BY_ENTITY_ALIAS);
8048 }
8049 else {
8050 query.append(_ORDER_BY_ENTITY_TABLE);
8051 }
8052
8053 query.append(orderByConditionFields[i]);
8054
8055 if ((i + 1) < orderByConditionFields.length) {
8056 if (orderByComparator.isAscending() ^ previous) {
8057 query.append(WHERE_GREATER_THAN_HAS_NEXT);
8058 }
8059 else {
8060 query.append(WHERE_LESSER_THAN_HAS_NEXT);
8061 }
8062 }
8063 else {
8064 if (orderByComparator.isAscending() ^ previous) {
8065 query.append(WHERE_GREATER_THAN);
8066 }
8067 else {
8068 query.append(WHERE_LESSER_THAN);
8069 }
8070 }
8071 }
8072
8073 query.append(ORDER_BY_CLAUSE);
8074
8075 String[] orderByFields = orderByComparator.getOrderByFields();
8076
8077 for (int i = 0; i < orderByFields.length; i++) {
8078 if (getDB().isSupportsInlineDistinct()) {
8079 query.append(_ORDER_BY_ENTITY_ALIAS);
8080 }
8081 else {
8082 query.append(_ORDER_BY_ENTITY_TABLE);
8083 }
8084
8085 query.append(orderByFields[i]);
8086
8087 if ((i + 1) < orderByFields.length) {
8088 if (orderByComparator.isAscending() ^ previous) {
8089 query.append(ORDER_BY_ASC_HAS_NEXT);
8090 }
8091 else {
8092 query.append(ORDER_BY_DESC_HAS_NEXT);
8093 }
8094 }
8095 else {
8096 if (orderByComparator.isAscending() ^ previous) {
8097 query.append(ORDER_BY_ASC);
8098 }
8099 else {
8100 query.append(ORDER_BY_DESC);
8101 }
8102 }
8103 }
8104 }
8105
8106 else {
8107 if (getDB().isSupportsInlineDistinct()) {
8108 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
8109 }
8110 else {
8111 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
8112 }
8113 }
8114
8115 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8116 JournalArticle.class.getName(),
8117 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
8118
8119 SQLQuery q = session.createSQLQuery(sql);
8120
8121 q.setFirstResult(0);
8122 q.setMaxResults(2);
8123
8124 if (getDB().isSupportsInlineDistinct()) {
8125 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
8126 }
8127 else {
8128 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
8129 }
8130
8131 QueryPos qPos = QueryPos.getInstance(q);
8132
8133 qPos.add(groupId);
8134
8135 if (structureId != null) {
8136 qPos.add(structureId);
8137 }
8138
8139 if (orderByComparator != null) {
8140 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
8141
8142 for (Object value : values) {
8143 qPos.add(value);
8144 }
8145 }
8146
8147 List<JournalArticle> list = q.list();
8148
8149 if (list.size() == 2) {
8150 return list.get(1);
8151 }
8152 else {
8153 return null;
8154 }
8155 }
8156
8157
8165 public List<JournalArticle> findByG_T(long groupId, String templateId)
8166 throws SystemException {
8167 return findByG_T(groupId, templateId, QueryUtil.ALL_POS,
8168 QueryUtil.ALL_POS, null);
8169 }
8170
8171
8185 public List<JournalArticle> findByG_T(long groupId, String templateId,
8186 int start, int end) throws SystemException {
8187 return findByG_T(groupId, templateId, start, end, null);
8188 }
8189
8190
8205 public List<JournalArticle> findByG_T(long groupId, String templateId,
8206 int start, int end, OrderByComparator orderByComparator)
8207 throws SystemException {
8208 FinderPath finderPath = null;
8209 Object[] finderArgs = null;
8210
8211 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
8212 (orderByComparator == null)) {
8213 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T;
8214 finderArgs = new Object[] { groupId, templateId };
8215 }
8216 else {
8217 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T;
8218 finderArgs = new Object[] {
8219 groupId, templateId,
8220
8221 start, end, orderByComparator
8222 };
8223 }
8224
8225 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
8226 finderArgs, this);
8227
8228 if ((list != null) && !list.isEmpty()) {
8229 for (JournalArticle journalArticle : list) {
8230 if ((groupId != journalArticle.getGroupId()) ||
8231 !Validator.equals(templateId,
8232 journalArticle.getTemplateId())) {
8233 list = null;
8234
8235 break;
8236 }
8237 }
8238 }
8239
8240 if (list == null) {
8241 StringBundler query = null;
8242
8243 if (orderByComparator != null) {
8244 query = new StringBundler(4 +
8245 (orderByComparator.getOrderByFields().length * 3));
8246 }
8247 else {
8248 query = new StringBundler(4);
8249 }
8250
8251 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
8252
8253 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
8254
8255 if (templateId == null) {
8256 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
8257 }
8258 else {
8259 if (templateId.equals(StringPool.BLANK)) {
8260 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
8261 }
8262 else {
8263 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
8264 }
8265 }
8266
8267 if (orderByComparator != null) {
8268 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8269 orderByComparator);
8270 }
8271
8272 else {
8273 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
8274 }
8275
8276 String sql = query.toString();
8277
8278 Session session = null;
8279
8280 try {
8281 session = openSession();
8282
8283 Query q = session.createQuery(sql);
8284
8285 QueryPos qPos = QueryPos.getInstance(q);
8286
8287 qPos.add(groupId);
8288
8289 if (templateId != null) {
8290 qPos.add(templateId);
8291 }
8292
8293 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
8294 start, end);
8295 }
8296 catch (Exception e) {
8297 throw processException(e);
8298 }
8299 finally {
8300 if (list == null) {
8301 FinderCacheUtil.removeResult(finderPath, finderArgs);
8302 }
8303 else {
8304 cacheResult(list);
8305
8306 FinderCacheUtil.putResult(finderPath, finderArgs, list);
8307 }
8308
8309 closeSession(session);
8310 }
8311 }
8312
8313 return list;
8314 }
8315
8316
8326 public JournalArticle findByG_T_First(long groupId, String templateId,
8327 OrderByComparator orderByComparator)
8328 throws NoSuchArticleException, SystemException {
8329 JournalArticle journalArticle = fetchByG_T_First(groupId, templateId,
8330 orderByComparator);
8331
8332 if (journalArticle != null) {
8333 return journalArticle;
8334 }
8335
8336 StringBundler msg = new StringBundler(6);
8337
8338 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8339
8340 msg.append("groupId=");
8341 msg.append(groupId);
8342
8343 msg.append(", templateId=");
8344 msg.append(templateId);
8345
8346 msg.append(StringPool.CLOSE_CURLY_BRACE);
8347
8348 throw new NoSuchArticleException(msg.toString());
8349 }
8350
8351
8360 public JournalArticle fetchByG_T_First(long groupId, String templateId,
8361 OrderByComparator orderByComparator) throws SystemException {
8362 List<JournalArticle> list = findByG_T(groupId, templateId, 0, 1,
8363 orderByComparator);
8364
8365 if (!list.isEmpty()) {
8366 return list.get(0);
8367 }
8368
8369 return null;
8370 }
8371
8372
8382 public JournalArticle findByG_T_Last(long groupId, String templateId,
8383 OrderByComparator orderByComparator)
8384 throws NoSuchArticleException, SystemException {
8385 JournalArticle journalArticle = fetchByG_T_Last(groupId, templateId,
8386 orderByComparator);
8387
8388 if (journalArticle != null) {
8389 return journalArticle;
8390 }
8391
8392 StringBundler msg = new StringBundler(6);
8393
8394 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8395
8396 msg.append("groupId=");
8397 msg.append(groupId);
8398
8399 msg.append(", templateId=");
8400 msg.append(templateId);
8401
8402 msg.append(StringPool.CLOSE_CURLY_BRACE);
8403
8404 throw new NoSuchArticleException(msg.toString());
8405 }
8406
8407
8416 public JournalArticle fetchByG_T_Last(long groupId, String templateId,
8417 OrderByComparator orderByComparator) throws SystemException {
8418 int count = countByG_T(groupId, templateId);
8419
8420 List<JournalArticle> list = findByG_T(groupId, templateId, count - 1,
8421 count, orderByComparator);
8422
8423 if (!list.isEmpty()) {
8424 return list.get(0);
8425 }
8426
8427 return null;
8428 }
8429
8430
8441 public JournalArticle[] findByG_T_PrevAndNext(long id, long groupId,
8442 String templateId, OrderByComparator orderByComparator)
8443 throws NoSuchArticleException, SystemException {
8444 JournalArticle journalArticle = findByPrimaryKey(id);
8445
8446 Session session = null;
8447
8448 try {
8449 session = openSession();
8450
8451 JournalArticle[] array = new JournalArticleImpl[3];
8452
8453 array[0] = getByG_T_PrevAndNext(session, journalArticle, groupId,
8454 templateId, orderByComparator, true);
8455
8456 array[1] = journalArticle;
8457
8458 array[2] = getByG_T_PrevAndNext(session, journalArticle, groupId,
8459 templateId, orderByComparator, false);
8460
8461 return array;
8462 }
8463 catch (Exception e) {
8464 throw processException(e);
8465 }
8466 finally {
8467 closeSession(session);
8468 }
8469 }
8470
8471 protected JournalArticle getByG_T_PrevAndNext(Session session,
8472 JournalArticle journalArticle, long groupId, String templateId,
8473 OrderByComparator orderByComparator, boolean previous) {
8474 StringBundler query = null;
8475
8476 if (orderByComparator != null) {
8477 query = new StringBundler(6 +
8478 (orderByComparator.getOrderByFields().length * 6));
8479 }
8480 else {
8481 query = new StringBundler(3);
8482 }
8483
8484 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
8485
8486 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
8487
8488 if (templateId == null) {
8489 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
8490 }
8491 else {
8492 if (templateId.equals(StringPool.BLANK)) {
8493 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
8494 }
8495 else {
8496 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
8497 }
8498 }
8499
8500 if (orderByComparator != null) {
8501 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8502
8503 if (orderByConditionFields.length > 0) {
8504 query.append(WHERE_AND);
8505 }
8506
8507 for (int i = 0; i < orderByConditionFields.length; i++) {
8508 query.append(_ORDER_BY_ENTITY_ALIAS);
8509 query.append(orderByConditionFields[i]);
8510
8511 if ((i + 1) < orderByConditionFields.length) {
8512 if (orderByComparator.isAscending() ^ previous) {
8513 query.append(WHERE_GREATER_THAN_HAS_NEXT);
8514 }
8515 else {
8516 query.append(WHERE_LESSER_THAN_HAS_NEXT);
8517 }
8518 }
8519 else {
8520 if (orderByComparator.isAscending() ^ previous) {
8521 query.append(WHERE_GREATER_THAN);
8522 }
8523 else {
8524 query.append(WHERE_LESSER_THAN);
8525 }
8526 }
8527 }
8528
8529 query.append(ORDER_BY_CLAUSE);
8530
8531 String[] orderByFields = orderByComparator.getOrderByFields();
8532
8533 for (int i = 0; i < orderByFields.length; i++) {
8534 query.append(_ORDER_BY_ENTITY_ALIAS);
8535 query.append(orderByFields[i]);
8536
8537 if ((i + 1) < orderByFields.length) {
8538 if (orderByComparator.isAscending() ^ previous) {
8539 query.append(ORDER_BY_ASC_HAS_NEXT);
8540 }
8541 else {
8542 query.append(ORDER_BY_DESC_HAS_NEXT);
8543 }
8544 }
8545 else {
8546 if (orderByComparator.isAscending() ^ previous) {
8547 query.append(ORDER_BY_ASC);
8548 }
8549 else {
8550 query.append(ORDER_BY_DESC);
8551 }
8552 }
8553 }
8554 }
8555
8556 else {
8557 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
8558 }
8559
8560 String sql = query.toString();
8561
8562 Query q = session.createQuery(sql);
8563
8564 q.setFirstResult(0);
8565 q.setMaxResults(2);
8566
8567 QueryPos qPos = QueryPos.getInstance(q);
8568
8569 qPos.add(groupId);
8570
8571 if (templateId != null) {
8572 qPos.add(templateId);
8573 }
8574
8575 if (orderByComparator != null) {
8576 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
8577
8578 for (Object value : values) {
8579 qPos.add(value);
8580 }
8581 }
8582
8583 List<JournalArticle> list = q.list();
8584
8585 if (list.size() == 2) {
8586 return list.get(1);
8587 }
8588 else {
8589 return null;
8590 }
8591 }
8592
8593
8601 public List<JournalArticle> filterFindByG_T(long groupId, String templateId)
8602 throws SystemException {
8603 return filterFindByG_T(groupId, templateId, QueryUtil.ALL_POS,
8604 QueryUtil.ALL_POS, null);
8605 }
8606
8607
8621 public List<JournalArticle> filterFindByG_T(long groupId,
8622 String templateId, int start, int end) throws SystemException {
8623 return filterFindByG_T(groupId, templateId, start, end, null);
8624 }
8625
8626
8641 public List<JournalArticle> filterFindByG_T(long groupId,
8642 String templateId, int start, int end,
8643 OrderByComparator orderByComparator) throws SystemException {
8644 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8645 return findByG_T(groupId, templateId, start, end, orderByComparator);
8646 }
8647
8648 StringBundler query = null;
8649
8650 if (orderByComparator != null) {
8651 query = new StringBundler(4 +
8652 (orderByComparator.getOrderByFields().length * 3));
8653 }
8654 else {
8655 query = new StringBundler(4);
8656 }
8657
8658 if (getDB().isSupportsInlineDistinct()) {
8659 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
8660 }
8661 else {
8662 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
8663 }
8664
8665 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
8666
8667 if (templateId == null) {
8668 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
8669 }
8670 else {
8671 if (templateId.equals(StringPool.BLANK)) {
8672 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
8673 }
8674 else {
8675 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
8676 }
8677 }
8678
8679 if (!getDB().isSupportsInlineDistinct()) {
8680 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
8681 }
8682
8683 if (orderByComparator != null) {
8684 if (getDB().isSupportsInlineDistinct()) {
8685 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8686 orderByComparator);
8687 }
8688 else {
8689 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
8690 orderByComparator);
8691 }
8692 }
8693
8694 else {
8695 if (getDB().isSupportsInlineDistinct()) {
8696 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
8697 }
8698 else {
8699 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
8700 }
8701 }
8702
8703 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8704 JournalArticle.class.getName(),
8705 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
8706
8707 Session session = null;
8708
8709 try {
8710 session = openSession();
8711
8712 SQLQuery q = session.createSQLQuery(sql);
8713
8714 if (getDB().isSupportsInlineDistinct()) {
8715 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
8716 }
8717 else {
8718 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
8719 }
8720
8721 QueryPos qPos = QueryPos.getInstance(q);
8722
8723 qPos.add(groupId);
8724
8725 if (templateId != null) {
8726 qPos.add(templateId);
8727 }
8728
8729 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
8730 end);
8731 }
8732 catch (Exception e) {
8733 throw processException(e);
8734 }
8735 finally {
8736 closeSession(session);
8737 }
8738 }
8739
8740
8751 public JournalArticle[] filterFindByG_T_PrevAndNext(long id, long groupId,
8752 String templateId, OrderByComparator orderByComparator)
8753 throws NoSuchArticleException, SystemException {
8754 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8755 return findByG_T_PrevAndNext(id, groupId, templateId,
8756 orderByComparator);
8757 }
8758
8759 JournalArticle journalArticle = findByPrimaryKey(id);
8760
8761 Session session = null;
8762
8763 try {
8764 session = openSession();
8765
8766 JournalArticle[] array = new JournalArticleImpl[3];
8767
8768 array[0] = filterGetByG_T_PrevAndNext(session, journalArticle,
8769 groupId, templateId, orderByComparator, true);
8770
8771 array[1] = journalArticle;
8772
8773 array[2] = filterGetByG_T_PrevAndNext(session, journalArticle,
8774 groupId, templateId, orderByComparator, false);
8775
8776 return array;
8777 }
8778 catch (Exception e) {
8779 throw processException(e);
8780 }
8781 finally {
8782 closeSession(session);
8783 }
8784 }
8785
8786 protected JournalArticle filterGetByG_T_PrevAndNext(Session session,
8787 JournalArticle journalArticle, long groupId, String templateId,
8788 OrderByComparator orderByComparator, boolean previous) {
8789 StringBundler query = null;
8790
8791 if (orderByComparator != null) {
8792 query = new StringBundler(6 +
8793 (orderByComparator.getOrderByFields().length * 6));
8794 }
8795 else {
8796 query = new StringBundler(3);
8797 }
8798
8799 if (getDB().isSupportsInlineDistinct()) {
8800 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
8801 }
8802 else {
8803 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
8804 }
8805
8806 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
8807
8808 if (templateId == null) {
8809 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
8810 }
8811 else {
8812 if (templateId.equals(StringPool.BLANK)) {
8813 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
8814 }
8815 else {
8816 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
8817 }
8818 }
8819
8820 if (!getDB().isSupportsInlineDistinct()) {
8821 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
8822 }
8823
8824 if (orderByComparator != null) {
8825 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8826
8827 if (orderByConditionFields.length > 0) {
8828 query.append(WHERE_AND);
8829 }
8830
8831 for (int i = 0; i < orderByConditionFields.length; i++) {
8832 if (getDB().isSupportsInlineDistinct()) {
8833 query.append(_ORDER_BY_ENTITY_ALIAS);
8834 }
8835 else {
8836 query.append(_ORDER_BY_ENTITY_TABLE);
8837 }
8838
8839 query.append(orderByConditionFields[i]);
8840
8841 if ((i + 1) < orderByConditionFields.length) {
8842 if (orderByComparator.isAscending() ^ previous) {
8843 query.append(WHERE_GREATER_THAN_HAS_NEXT);
8844 }
8845 else {
8846 query.append(WHERE_LESSER_THAN_HAS_NEXT);
8847 }
8848 }
8849 else {
8850 if (orderByComparator.isAscending() ^ previous) {
8851 query.append(WHERE_GREATER_THAN);
8852 }
8853 else {
8854 query.append(WHERE_LESSER_THAN);
8855 }
8856 }
8857 }
8858
8859 query.append(ORDER_BY_CLAUSE);
8860
8861 String[] orderByFields = orderByComparator.getOrderByFields();
8862
8863 for (int i = 0; i < orderByFields.length; i++) {
8864 if (getDB().isSupportsInlineDistinct()) {
8865 query.append(_ORDER_BY_ENTITY_ALIAS);
8866 }
8867 else {
8868 query.append(_ORDER_BY_ENTITY_TABLE);
8869 }
8870
8871 query.append(orderByFields[i]);
8872
8873 if ((i + 1) < orderByFields.length) {
8874 if (orderByComparator.isAscending() ^ previous) {
8875 query.append(ORDER_BY_ASC_HAS_NEXT);
8876 }
8877 else {
8878 query.append(ORDER_BY_DESC_HAS_NEXT);
8879 }
8880 }
8881 else {
8882 if (orderByComparator.isAscending() ^ previous) {
8883 query.append(ORDER_BY_ASC);
8884 }
8885 else {
8886 query.append(ORDER_BY_DESC);
8887 }
8888 }
8889 }
8890 }
8891
8892 else {
8893 if (getDB().isSupportsInlineDistinct()) {
8894 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
8895 }
8896 else {
8897 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
8898 }
8899 }
8900
8901 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8902 JournalArticle.class.getName(),
8903 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
8904
8905 SQLQuery q = session.createSQLQuery(sql);
8906
8907 q.setFirstResult(0);
8908 q.setMaxResults(2);
8909
8910 if (getDB().isSupportsInlineDistinct()) {
8911 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
8912 }
8913 else {
8914 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
8915 }
8916
8917 QueryPos qPos = QueryPos.getInstance(q);
8918
8919 qPos.add(groupId);
8920
8921 if (templateId != null) {
8922 qPos.add(templateId);
8923 }
8924
8925 if (orderByComparator != null) {
8926 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
8927
8928 for (Object value : values) {
8929 qPos.add(value);
8930 }
8931 }
8932
8933 List<JournalArticle> list = q.list();
8934
8935 if (list.size() == 2) {
8936 return list.get(1);
8937 }
8938 else {
8939 return null;
8940 }
8941 }
8942
8943
8951 public List<JournalArticle> findByG_L(long groupId, String layoutUuid)
8952 throws SystemException {
8953 return findByG_L(groupId, layoutUuid, QueryUtil.ALL_POS,
8954 QueryUtil.ALL_POS, null);
8955 }
8956
8957
8971 public List<JournalArticle> findByG_L(long groupId, String layoutUuid,
8972 int start, int end) throws SystemException {
8973 return findByG_L(groupId, layoutUuid, start, end, null);
8974 }
8975
8976
8991 public List<JournalArticle> findByG_L(long groupId, String layoutUuid,
8992 int start, int end, OrderByComparator orderByComparator)
8993 throws SystemException {
8994 FinderPath finderPath = null;
8995 Object[] finderArgs = null;
8996
8997 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
8998 (orderByComparator == null)) {
8999 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_L;
9000 finderArgs = new Object[] { groupId, layoutUuid };
9001 }
9002 else {
9003 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_L;
9004 finderArgs = new Object[] {
9005 groupId, layoutUuid,
9006
9007 start, end, orderByComparator
9008 };
9009 }
9010
9011 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
9012 finderArgs, this);
9013
9014 if ((list != null) && !list.isEmpty()) {
9015 for (JournalArticle journalArticle : list) {
9016 if ((groupId != journalArticle.getGroupId()) ||
9017 !Validator.equals(layoutUuid,
9018 journalArticle.getLayoutUuid())) {
9019 list = null;
9020
9021 break;
9022 }
9023 }
9024 }
9025
9026 if (list == null) {
9027 StringBundler query = null;
9028
9029 if (orderByComparator != null) {
9030 query = new StringBundler(4 +
9031 (orderByComparator.getOrderByFields().length * 3));
9032 }
9033 else {
9034 query = new StringBundler(4);
9035 }
9036
9037 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
9038
9039 query.append(_FINDER_COLUMN_G_L_GROUPID_2);
9040
9041 if (layoutUuid == null) {
9042 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_1);
9043 }
9044 else {
9045 if (layoutUuid.equals(StringPool.BLANK)) {
9046 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_3);
9047 }
9048 else {
9049 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_2);
9050 }
9051 }
9052
9053 if (orderByComparator != null) {
9054 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
9055 orderByComparator);
9056 }
9057
9058 else {
9059 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
9060 }
9061
9062 String sql = query.toString();
9063
9064 Session session = null;
9065
9066 try {
9067 session = openSession();
9068
9069 Query q = session.createQuery(sql);
9070
9071 QueryPos qPos = QueryPos.getInstance(q);
9072
9073 qPos.add(groupId);
9074
9075 if (layoutUuid != null) {
9076 qPos.add(layoutUuid);
9077 }
9078
9079 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
9080 start, end);
9081 }
9082 catch (Exception e) {
9083 throw processException(e);
9084 }
9085 finally {
9086 if (list == null) {
9087 FinderCacheUtil.removeResult(finderPath, finderArgs);
9088 }
9089 else {
9090 cacheResult(list);
9091
9092 FinderCacheUtil.putResult(finderPath, finderArgs, list);
9093 }
9094
9095 closeSession(session);
9096 }
9097 }
9098
9099 return list;
9100 }
9101
9102
9112 public JournalArticle findByG_L_First(long groupId, String layoutUuid,
9113 OrderByComparator orderByComparator)
9114 throws NoSuchArticleException, SystemException {
9115 JournalArticle journalArticle = fetchByG_L_First(groupId, layoutUuid,
9116 orderByComparator);
9117
9118 if (journalArticle != null) {
9119 return journalArticle;
9120 }
9121
9122 StringBundler msg = new StringBundler(6);
9123
9124 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
9125
9126 msg.append("groupId=");
9127 msg.append(groupId);
9128
9129 msg.append(", layoutUuid=");
9130 msg.append(layoutUuid);
9131
9132 msg.append(StringPool.CLOSE_CURLY_BRACE);
9133
9134 throw new NoSuchArticleException(msg.toString());
9135 }
9136
9137
9146 public JournalArticle fetchByG_L_First(long groupId, String layoutUuid,
9147 OrderByComparator orderByComparator) throws SystemException {
9148 List<JournalArticle> list = findByG_L(groupId, layoutUuid, 0, 1,
9149 orderByComparator);
9150
9151 if (!list.isEmpty()) {
9152 return list.get(0);
9153 }
9154
9155 return null;
9156 }
9157
9158
9168 public JournalArticle findByG_L_Last(long groupId, String layoutUuid,
9169 OrderByComparator orderByComparator)
9170 throws NoSuchArticleException, SystemException {
9171 JournalArticle journalArticle = fetchByG_L_Last(groupId, layoutUuid,
9172 orderByComparator);
9173
9174 if (journalArticle != null) {
9175 return journalArticle;
9176 }
9177
9178 StringBundler msg = new StringBundler(6);
9179
9180 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
9181
9182 msg.append("groupId=");
9183 msg.append(groupId);
9184
9185 msg.append(", layoutUuid=");
9186 msg.append(layoutUuid);
9187
9188 msg.append(StringPool.CLOSE_CURLY_BRACE);
9189
9190 throw new NoSuchArticleException(msg.toString());
9191 }
9192
9193
9202 public JournalArticle fetchByG_L_Last(long groupId, String layoutUuid,
9203 OrderByComparator orderByComparator) throws SystemException {
9204 int count = countByG_L(groupId, layoutUuid);
9205
9206 List<JournalArticle> list = findByG_L(groupId, layoutUuid, count - 1,
9207 count, orderByComparator);
9208
9209 if (!list.isEmpty()) {
9210 return list.get(0);
9211 }
9212
9213 return null;
9214 }
9215
9216
9227 public JournalArticle[] findByG_L_PrevAndNext(long id, long groupId,
9228 String layoutUuid, OrderByComparator orderByComparator)
9229 throws NoSuchArticleException, SystemException {
9230 JournalArticle journalArticle = findByPrimaryKey(id);
9231
9232 Session session = null;
9233
9234 try {
9235 session = openSession();
9236
9237 JournalArticle[] array = new JournalArticleImpl[3];
9238
9239 array[0] = getByG_L_PrevAndNext(session, journalArticle, groupId,
9240 layoutUuid, orderByComparator, true);
9241
9242 array[1] = journalArticle;
9243
9244 array[2] = getByG_L_PrevAndNext(session, journalArticle, groupId,
9245 layoutUuid, orderByComparator, false);
9246
9247 return array;
9248 }
9249 catch (Exception e) {
9250 throw processException(e);
9251 }
9252 finally {
9253 closeSession(session);
9254 }
9255 }
9256
9257 protected JournalArticle getByG_L_PrevAndNext(Session session,
9258 JournalArticle journalArticle, long groupId, String layoutUuid,
9259 OrderByComparator orderByComparator, boolean previous) {
9260 StringBundler query = null;
9261
9262 if (orderByComparator != null) {
9263 query = new StringBundler(6 +
9264 (orderByComparator.getOrderByFields().length * 6));
9265 }
9266 else {
9267 query = new StringBundler(3);
9268 }
9269
9270 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
9271
9272 query.append(_FINDER_COLUMN_G_L_GROUPID_2);
9273
9274 if (layoutUuid == null) {
9275 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_1);
9276 }
9277 else {
9278 if (layoutUuid.equals(StringPool.BLANK)) {
9279 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_3);
9280 }
9281 else {
9282 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_2);
9283 }
9284 }
9285
9286 if (orderByComparator != null) {
9287 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
9288
9289 if (orderByConditionFields.length > 0) {
9290 query.append(WHERE_AND);
9291 }
9292
9293 for (int i = 0; i < orderByConditionFields.length; i++) {
9294 query.append(_ORDER_BY_ENTITY_ALIAS);
9295 query.append(orderByConditionFields[i]);
9296
9297 if ((i + 1) < orderByConditionFields.length) {
9298 if (orderByComparator.isAscending() ^ previous) {
9299 query.append(WHERE_GREATER_THAN_HAS_NEXT);
9300 }
9301 else {
9302 query.append(WHERE_LESSER_THAN_HAS_NEXT);
9303 }
9304 }
9305 else {
9306 if (orderByComparator.isAscending() ^ previous) {
9307 query.append(WHERE_GREATER_THAN);
9308 }
9309 else {
9310 query.append(WHERE_LESSER_THAN);
9311 }
9312 }
9313 }
9314
9315 query.append(ORDER_BY_CLAUSE);
9316
9317 String[] orderByFields = orderByComparator.getOrderByFields();
9318
9319 for (int i = 0; i < orderByFields.length; i++) {
9320 query.append(_ORDER_BY_ENTITY_ALIAS);
9321 query.append(orderByFields[i]);
9322
9323 if ((i + 1) < orderByFields.length) {
9324 if (orderByComparator.isAscending() ^ previous) {
9325 query.append(ORDER_BY_ASC_HAS_NEXT);
9326 }
9327 else {
9328 query.append(ORDER_BY_DESC_HAS_NEXT);
9329 }
9330 }
9331 else {
9332 if (orderByComparator.isAscending() ^ previous) {
9333 query.append(ORDER_BY_ASC);
9334 }
9335 else {
9336 query.append(ORDER_BY_DESC);
9337 }
9338 }
9339 }
9340 }
9341
9342 else {
9343 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
9344 }
9345
9346 String sql = query.toString();
9347
9348 Query q = session.createQuery(sql);
9349
9350 q.setFirstResult(0);
9351 q.setMaxResults(2);
9352
9353 QueryPos qPos = QueryPos.getInstance(q);
9354
9355 qPos.add(groupId);
9356
9357 if (layoutUuid != null) {
9358 qPos.add(layoutUuid);
9359 }
9360
9361 if (orderByComparator != null) {
9362 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
9363
9364 for (Object value : values) {
9365 qPos.add(value);
9366 }
9367 }
9368
9369 List<JournalArticle> list = q.list();
9370
9371 if (list.size() == 2) {
9372 return list.get(1);
9373 }
9374 else {
9375 return null;
9376 }
9377 }
9378
9379
9387 public List<JournalArticle> filterFindByG_L(long groupId, String layoutUuid)
9388 throws SystemException {
9389 return filterFindByG_L(groupId, layoutUuid, QueryUtil.ALL_POS,
9390 QueryUtil.ALL_POS, null);
9391 }
9392
9393
9407 public List<JournalArticle> filterFindByG_L(long groupId,
9408 String layoutUuid, int start, int end) throws SystemException {
9409 return filterFindByG_L(groupId, layoutUuid, start, end, null);
9410 }
9411
9412
9427 public List<JournalArticle> filterFindByG_L(long groupId,
9428 String layoutUuid, int start, int end,
9429 OrderByComparator orderByComparator) throws SystemException {
9430 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
9431 return findByG_L(groupId, layoutUuid, start, end, orderByComparator);
9432 }
9433
9434 StringBundler query = null;
9435
9436 if (orderByComparator != null) {
9437 query = new StringBundler(4 +
9438 (orderByComparator.getOrderByFields().length * 3));
9439 }
9440 else {
9441 query = new StringBundler(4);
9442 }
9443
9444 if (getDB().isSupportsInlineDistinct()) {
9445 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
9446 }
9447 else {
9448 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
9449 }
9450
9451 query.append(_FINDER_COLUMN_G_L_GROUPID_2);
9452
9453 if (layoutUuid == null) {
9454 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_1);
9455 }
9456 else {
9457 if (layoutUuid.equals(StringPool.BLANK)) {
9458 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_3);
9459 }
9460 else {
9461 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_2);
9462 }
9463 }
9464
9465 if (!getDB().isSupportsInlineDistinct()) {
9466 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
9467 }
9468
9469 if (orderByComparator != null) {
9470 if (getDB().isSupportsInlineDistinct()) {
9471 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
9472 orderByComparator);
9473 }
9474 else {
9475 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
9476 orderByComparator);
9477 }
9478 }
9479
9480 else {
9481 if (getDB().isSupportsInlineDistinct()) {
9482 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
9483 }
9484 else {
9485 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
9486 }
9487 }
9488
9489 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
9490 JournalArticle.class.getName(),
9491 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
9492
9493 Session session = null;
9494
9495 try {
9496 session = openSession();
9497
9498 SQLQuery q = session.createSQLQuery(sql);
9499
9500 if (getDB().isSupportsInlineDistinct()) {
9501 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
9502 }
9503 else {
9504 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
9505 }
9506
9507 QueryPos qPos = QueryPos.getInstance(q);
9508
9509 qPos.add(groupId);
9510
9511 if (layoutUuid != null) {
9512 qPos.add(layoutUuid);
9513 }
9514
9515 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
9516 end);
9517 }
9518 catch (Exception e) {
9519 throw processException(e);
9520 }
9521 finally {
9522 closeSession(session);
9523 }
9524 }
9525
9526
9537 public JournalArticle[] filterFindByG_L_PrevAndNext(long id, long groupId,
9538 String layoutUuid, OrderByComparator orderByComparator)
9539 throws NoSuchArticleException, SystemException {
9540 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
9541 return findByG_L_PrevAndNext(id, groupId, layoutUuid,
9542 orderByComparator);
9543 }
9544
9545 JournalArticle journalArticle = findByPrimaryKey(id);
9546
9547 Session session = null;
9548
9549 try {
9550 session = openSession();
9551
9552 JournalArticle[] array = new JournalArticleImpl[3];
9553
9554 array[0] = filterGetByG_L_PrevAndNext(session, journalArticle,
9555 groupId, layoutUuid, orderByComparator, true);
9556
9557 array[1] = journalArticle;
9558
9559 array[2] = filterGetByG_L_PrevAndNext(session, journalArticle,
9560 groupId, layoutUuid, orderByComparator, false);
9561
9562 return array;
9563 }
9564 catch (Exception e) {
9565 throw processException(e);
9566 }
9567 finally {
9568 closeSession(session);
9569 }
9570 }
9571
9572 protected JournalArticle filterGetByG_L_PrevAndNext(Session session,
9573 JournalArticle journalArticle, long groupId, String layoutUuid,
9574 OrderByComparator orderByComparator, boolean previous) {
9575 StringBundler query = null;
9576
9577 if (orderByComparator != null) {
9578 query = new StringBundler(6 +
9579 (orderByComparator.getOrderByFields().length * 6));
9580 }
9581 else {
9582 query = new StringBundler(3);
9583 }
9584
9585 if (getDB().isSupportsInlineDistinct()) {
9586 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
9587 }
9588 else {
9589 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
9590 }
9591
9592 query.append(_FINDER_COLUMN_G_L_GROUPID_2);
9593
9594 if (layoutUuid == null) {
9595 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_1);
9596 }
9597 else {
9598 if (layoutUuid.equals(StringPool.BLANK)) {
9599 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_3);
9600 }
9601 else {
9602 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_2);
9603 }
9604 }
9605
9606 if (!getDB().isSupportsInlineDistinct()) {
9607 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
9608 }
9609
9610 if (orderByComparator != null) {
9611 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
9612
9613 if (orderByConditionFields.length > 0) {
9614 query.append(WHERE_AND);
9615 }
9616
9617 for (int i = 0; i < orderByConditionFields.length; i++) {
9618 if (getDB().isSupportsInlineDistinct()) {
9619 query.append(_ORDER_BY_ENTITY_ALIAS);
9620 }
9621 else {
9622 query.append(_ORDER_BY_ENTITY_TABLE);
9623 }
9624
9625 query.append(orderByConditionFields[i]);
9626
9627 if ((i + 1) < orderByConditionFields.length) {
9628 if (orderByComparator.isAscending() ^ previous) {
9629 query.append(WHERE_GREATER_THAN_HAS_NEXT);
9630 }
9631 else {
9632 query.append(WHERE_LESSER_THAN_HAS_NEXT);
9633 }
9634 }
9635 else {
9636 if (orderByComparator.isAscending() ^ previous) {
9637 query.append(WHERE_GREATER_THAN);
9638 }
9639 else {
9640 query.append(WHERE_LESSER_THAN);
9641 }
9642 }
9643 }
9644
9645 query.append(ORDER_BY_CLAUSE);
9646
9647 String[] orderByFields = orderByComparator.getOrderByFields();
9648
9649 for (int i = 0; i < orderByFields.length; i++) {
9650 if (getDB().isSupportsInlineDistinct()) {
9651 query.append(_ORDER_BY_ENTITY_ALIAS);
9652 }
9653 else {
9654 query.append(_ORDER_BY_ENTITY_TABLE);
9655 }
9656
9657 query.append(orderByFields[i]);
9658
9659 if ((i + 1) < orderByFields.length) {
9660 if (orderByComparator.isAscending() ^ previous) {
9661 query.append(ORDER_BY_ASC_HAS_NEXT);
9662 }
9663 else {
9664 query.append(ORDER_BY_DESC_HAS_NEXT);
9665 }
9666 }
9667 else {
9668 if (orderByComparator.isAscending() ^ previous) {
9669 query.append(ORDER_BY_ASC);
9670 }
9671 else {
9672 query.append(ORDER_BY_DESC);
9673 }
9674 }
9675 }
9676 }
9677
9678 else {
9679 if (getDB().isSupportsInlineDistinct()) {
9680 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
9681 }
9682 else {
9683 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
9684 }
9685 }
9686
9687 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
9688 JournalArticle.class.getName(),
9689 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
9690
9691 SQLQuery q = session.createSQLQuery(sql);
9692
9693 q.setFirstResult(0);
9694 q.setMaxResults(2);
9695
9696 if (getDB().isSupportsInlineDistinct()) {
9697 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
9698 }
9699 else {
9700 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
9701 }
9702
9703 QueryPos qPos = QueryPos.getInstance(q);
9704
9705 qPos.add(groupId);
9706
9707 if (layoutUuid != null) {
9708 qPos.add(layoutUuid);
9709 }
9710
9711 if (orderByComparator != null) {
9712 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
9713
9714 for (Object value : values) {
9715 qPos.add(value);
9716 }
9717 }
9718
9719 List<JournalArticle> list = q.list();
9720
9721 if (list.size() == 2) {
9722 return list.get(1);
9723 }
9724 else {
9725 return null;
9726 }
9727 }
9728
9729
9737 public List<JournalArticle> findByG_ST(long groupId, int status)
9738 throws SystemException {
9739 return findByG_ST(groupId, status, QueryUtil.ALL_POS,
9740 QueryUtil.ALL_POS, null);
9741 }
9742
9743
9757 public List<JournalArticle> findByG_ST(long groupId, int status, int start,
9758 int end) throws SystemException {
9759 return findByG_ST(groupId, status, start, end, null);
9760 }
9761
9762
9777 public List<JournalArticle> findByG_ST(long groupId, int status, int start,
9778 int end, OrderByComparator orderByComparator) throws SystemException {
9779 FinderPath finderPath = null;
9780 Object[] finderArgs = null;
9781
9782 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
9783 (orderByComparator == null)) {
9784 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_ST;
9785 finderArgs = new Object[] { groupId, status };
9786 }
9787 else {
9788 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_ST;
9789 finderArgs = new Object[] {
9790 groupId, status,
9791
9792 start, end, orderByComparator
9793 };
9794 }
9795
9796 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
9797 finderArgs, this);
9798
9799 if ((list != null) && !list.isEmpty()) {
9800 for (JournalArticle journalArticle : list) {
9801 if ((groupId != journalArticle.getGroupId()) ||
9802 (status != journalArticle.getStatus())) {
9803 list = null;
9804
9805 break;
9806 }
9807 }
9808 }
9809
9810 if (list == null) {
9811 StringBundler query = null;
9812
9813 if (orderByComparator != null) {
9814 query = new StringBundler(4 +
9815 (orderByComparator.getOrderByFields().length * 3));
9816 }
9817 else {
9818 query = new StringBundler(4);
9819 }
9820
9821 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
9822
9823 query.append(_FINDER_COLUMN_G_ST_GROUPID_2);
9824
9825 query.append(_FINDER_COLUMN_G_ST_STATUS_2);
9826
9827 if (orderByComparator != null) {
9828 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
9829 orderByComparator);
9830 }
9831
9832 else {
9833 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
9834 }
9835
9836 String sql = query.toString();
9837
9838 Session session = null;
9839
9840 try {
9841 session = openSession();
9842
9843 Query q = session.createQuery(sql);
9844
9845 QueryPos qPos = QueryPos.getInstance(q);
9846
9847 qPos.add(groupId);
9848
9849 qPos.add(status);
9850
9851 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
9852 start, end);
9853 }
9854 catch (Exception e) {
9855 throw processException(e);
9856 }
9857 finally {
9858 if (list == null) {
9859 FinderCacheUtil.removeResult(finderPath, finderArgs);
9860 }
9861 else {
9862 cacheResult(list);
9863
9864 FinderCacheUtil.putResult(finderPath, finderArgs, list);
9865 }
9866
9867 closeSession(session);
9868 }
9869 }
9870
9871 return list;
9872 }
9873
9874
9884 public JournalArticle findByG_ST_First(long groupId, int status,
9885 OrderByComparator orderByComparator)
9886 throws NoSuchArticleException, SystemException {
9887 JournalArticle journalArticle = fetchByG_ST_First(groupId, status,
9888 orderByComparator);
9889
9890 if (journalArticle != null) {
9891 return journalArticle;
9892 }
9893
9894 StringBundler msg = new StringBundler(6);
9895
9896 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
9897
9898 msg.append("groupId=");
9899 msg.append(groupId);
9900
9901 msg.append(", status=");
9902 msg.append(status);
9903
9904 msg.append(StringPool.CLOSE_CURLY_BRACE);
9905
9906 throw new NoSuchArticleException(msg.toString());
9907 }
9908
9909
9918 public JournalArticle fetchByG_ST_First(long groupId, int status,
9919 OrderByComparator orderByComparator) throws SystemException {
9920 List<JournalArticle> list = findByG_ST(groupId, status, 0, 1,
9921 orderByComparator);
9922
9923 if (!list.isEmpty()) {
9924 return list.get(0);
9925 }
9926
9927 return null;
9928 }
9929
9930
9940 public JournalArticle findByG_ST_Last(long groupId, int status,
9941 OrderByComparator orderByComparator)
9942 throws NoSuchArticleException, SystemException {
9943 JournalArticle journalArticle = fetchByG_ST_Last(groupId, status,
9944 orderByComparator);
9945
9946 if (journalArticle != null) {
9947 return journalArticle;
9948 }
9949
9950 StringBundler msg = new StringBundler(6);
9951
9952 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
9953
9954 msg.append("groupId=");
9955 msg.append(groupId);
9956
9957 msg.append(", status=");
9958 msg.append(status);
9959
9960 msg.append(StringPool.CLOSE_CURLY_BRACE);
9961
9962 throw new NoSuchArticleException(msg.toString());
9963 }
9964
9965
9974 public JournalArticle fetchByG_ST_Last(long groupId, int status,
9975 OrderByComparator orderByComparator) throws SystemException {
9976 int count = countByG_ST(groupId, status);
9977
9978 List<JournalArticle> list = findByG_ST(groupId, status, count - 1,
9979 count, orderByComparator);
9980
9981 if (!list.isEmpty()) {
9982 return list.get(0);
9983 }
9984
9985 return null;
9986 }
9987
9988
9999 public JournalArticle[] findByG_ST_PrevAndNext(long id, long groupId,
10000 int status, OrderByComparator orderByComparator)
10001 throws NoSuchArticleException, SystemException {
10002 JournalArticle journalArticle = findByPrimaryKey(id);
10003
10004 Session session = null;
10005
10006 try {
10007 session = openSession();
10008
10009 JournalArticle[] array = new JournalArticleImpl[3];
10010
10011 array[0] = getByG_ST_PrevAndNext(session, journalArticle, groupId,
10012 status, orderByComparator, true);
10013
10014 array[1] = journalArticle;
10015
10016 array[2] = getByG_ST_PrevAndNext(session, journalArticle, groupId,
10017 status, orderByComparator, false);
10018
10019 return array;
10020 }
10021 catch (Exception e) {
10022 throw processException(e);
10023 }
10024 finally {
10025 closeSession(session);
10026 }
10027 }
10028
10029 protected JournalArticle getByG_ST_PrevAndNext(Session session,
10030 JournalArticle journalArticle, long groupId, int status,
10031 OrderByComparator orderByComparator, boolean previous) {
10032 StringBundler query = null;
10033
10034 if (orderByComparator != null) {
10035 query = new StringBundler(6 +
10036 (orderByComparator.getOrderByFields().length * 6));
10037 }
10038 else {
10039 query = new StringBundler(3);
10040 }
10041
10042 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
10043
10044 query.append(_FINDER_COLUMN_G_ST_GROUPID_2);
10045
10046 query.append(_FINDER_COLUMN_G_ST_STATUS_2);
10047
10048 if (orderByComparator != null) {
10049 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
10050
10051 if (orderByConditionFields.length > 0) {
10052 query.append(WHERE_AND);
10053 }
10054
10055 for (int i = 0; i < orderByConditionFields.length; i++) {
10056 query.append(_ORDER_BY_ENTITY_ALIAS);
10057 query.append(orderByConditionFields[i]);
10058
10059 if ((i + 1) < orderByConditionFields.length) {
10060 if (orderByComparator.isAscending() ^ previous) {
10061 query.append(WHERE_GREATER_THAN_HAS_NEXT);
10062 }
10063 else {
10064 query.append(WHERE_LESSER_THAN_HAS_NEXT);
10065 }
10066 }
10067 else {
10068 if (orderByComparator.isAscending() ^ previous) {
10069 query.append(WHERE_GREATER_THAN);
10070 }
10071 else {
10072 query.append(WHERE_LESSER_THAN);
10073 }
10074 }
10075 }
10076
10077 query.append(ORDER_BY_CLAUSE);
10078
10079 String[] orderByFields = orderByComparator.getOrderByFields();
10080
10081 for (int i = 0; i < orderByFields.length; i++) {
10082 query.append(_ORDER_BY_ENTITY_ALIAS);
10083 query.append(orderByFields[i]);
10084
10085 if ((i + 1) < orderByFields.length) {
10086 if (orderByComparator.isAscending() ^ previous) {
10087 query.append(ORDER_BY_ASC_HAS_NEXT);
10088 }
10089 else {
10090 query.append(ORDER_BY_DESC_HAS_NEXT);
10091 }
10092 }
10093 else {
10094 if (orderByComparator.isAscending() ^ previous) {
10095 query.append(ORDER_BY_ASC);
10096 }
10097 else {
10098 query.append(ORDER_BY_DESC);
10099 }
10100 }
10101 }
10102 }
10103
10104 else {
10105 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
10106 }
10107
10108 String sql = query.toString();
10109
10110 Query q = session.createQuery(sql);
10111
10112 q.setFirstResult(0);
10113 q.setMaxResults(2);
10114
10115 QueryPos qPos = QueryPos.getInstance(q);
10116
10117 qPos.add(groupId);
10118
10119 qPos.add(status);
10120
10121 if (orderByComparator != null) {
10122 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
10123
10124 for (Object value : values) {
10125 qPos.add(value);
10126 }
10127 }
10128
10129 List<JournalArticle> list = q.list();
10130
10131 if (list.size() == 2) {
10132 return list.get(1);
10133 }
10134 else {
10135 return null;
10136 }
10137 }
10138
10139
10147 public List<JournalArticle> filterFindByG_ST(long groupId, int status)
10148 throws SystemException {
10149 return filterFindByG_ST(groupId, status, QueryUtil.ALL_POS,
10150 QueryUtil.ALL_POS, null);
10151 }
10152
10153
10167 public List<JournalArticle> filterFindByG_ST(long groupId, int status,
10168 int start, int end) throws SystemException {
10169 return filterFindByG_ST(groupId, status, start, end, null);
10170 }
10171
10172
10187 public List<JournalArticle> filterFindByG_ST(long groupId, int status,
10188 int start, int end, OrderByComparator orderByComparator)
10189 throws SystemException {
10190 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10191 return findByG_ST(groupId, status, start, end, orderByComparator);
10192 }
10193
10194 StringBundler query = null;
10195
10196 if (orderByComparator != null) {
10197 query = new StringBundler(4 +
10198 (orderByComparator.getOrderByFields().length * 3));
10199 }
10200 else {
10201 query = new StringBundler(4);
10202 }
10203
10204 if (getDB().isSupportsInlineDistinct()) {
10205 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
10206 }
10207 else {
10208 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
10209 }
10210
10211 query.append(_FINDER_COLUMN_G_ST_GROUPID_2);
10212
10213 query.append(_FINDER_COLUMN_G_ST_STATUS_2);
10214
10215 if (!getDB().isSupportsInlineDistinct()) {
10216 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
10217 }
10218
10219 if (orderByComparator != null) {
10220 if (getDB().isSupportsInlineDistinct()) {
10221 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
10222 orderByComparator);
10223 }
10224 else {
10225 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
10226 orderByComparator);
10227 }
10228 }
10229
10230 else {
10231 if (getDB().isSupportsInlineDistinct()) {
10232 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
10233 }
10234 else {
10235 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
10236 }
10237 }
10238
10239 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10240 JournalArticle.class.getName(),
10241 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10242
10243 Session session = null;
10244
10245 try {
10246 session = openSession();
10247
10248 SQLQuery q = session.createSQLQuery(sql);
10249
10250 if (getDB().isSupportsInlineDistinct()) {
10251 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
10252 }
10253 else {
10254 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
10255 }
10256
10257 QueryPos qPos = QueryPos.getInstance(q);
10258
10259 qPos.add(groupId);
10260
10261 qPos.add(status);
10262
10263 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
10264 end);
10265 }
10266 catch (Exception e) {
10267 throw processException(e);
10268 }
10269 finally {
10270 closeSession(session);
10271 }
10272 }
10273
10274
10285 public JournalArticle[] filterFindByG_ST_PrevAndNext(long id, long groupId,
10286 int status, OrderByComparator orderByComparator)
10287 throws NoSuchArticleException, SystemException {
10288 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10289 return findByG_ST_PrevAndNext(id, groupId, status, orderByComparator);
10290 }
10291
10292 JournalArticle journalArticle = findByPrimaryKey(id);
10293
10294 Session session = null;
10295
10296 try {
10297 session = openSession();
10298
10299 JournalArticle[] array = new JournalArticleImpl[3];
10300
10301 array[0] = filterGetByG_ST_PrevAndNext(session, journalArticle,
10302 groupId, status, orderByComparator, true);
10303
10304 array[1] = journalArticle;
10305
10306 array[2] = filterGetByG_ST_PrevAndNext(session, journalArticle,
10307 groupId, status, orderByComparator, false);
10308
10309 return array;
10310 }
10311 catch (Exception e) {
10312 throw processException(e);
10313 }
10314 finally {
10315 closeSession(session);
10316 }
10317 }
10318
10319 protected JournalArticle filterGetByG_ST_PrevAndNext(Session session,
10320 JournalArticle journalArticle, long groupId, int status,
10321 OrderByComparator orderByComparator, boolean previous) {
10322 StringBundler query = null;
10323
10324 if (orderByComparator != null) {
10325 query = new StringBundler(6 +
10326 (orderByComparator.getOrderByFields().length * 6));
10327 }
10328 else {
10329 query = new StringBundler(3);
10330 }
10331
10332 if (getDB().isSupportsInlineDistinct()) {
10333 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
10334 }
10335 else {
10336 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
10337 }
10338
10339 query.append(_FINDER_COLUMN_G_ST_GROUPID_2);
10340
10341 query.append(_FINDER_COLUMN_G_ST_STATUS_2);
10342
10343 if (!getDB().isSupportsInlineDistinct()) {
10344 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
10345 }
10346
10347 if (orderByComparator != null) {
10348 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
10349
10350 if (orderByConditionFields.length > 0) {
10351 query.append(WHERE_AND);
10352 }
10353
10354 for (int i = 0; i < orderByConditionFields.length; i++) {
10355 if (getDB().isSupportsInlineDistinct()) {
10356 query.append(_ORDER_BY_ENTITY_ALIAS);
10357 }
10358 else {
10359 query.append(_ORDER_BY_ENTITY_TABLE);
10360 }
10361
10362 query.append(orderByConditionFields[i]);
10363
10364 if ((i + 1) < orderByConditionFields.length) {
10365 if (orderByComparator.isAscending() ^ previous) {
10366 query.append(WHERE_GREATER_THAN_HAS_NEXT);
10367 }
10368 else {
10369 query.append(WHERE_LESSER_THAN_HAS_NEXT);
10370 }
10371 }
10372 else {
10373 if (orderByComparator.isAscending() ^ previous) {
10374 query.append(WHERE_GREATER_THAN);
10375 }
10376 else {
10377 query.append(WHERE_LESSER_THAN);
10378 }
10379 }
10380 }
10381
10382 query.append(ORDER_BY_CLAUSE);
10383
10384 String[] orderByFields = orderByComparator.getOrderByFields();
10385
10386 for (int i = 0; i < orderByFields.length; i++) {
10387 if (getDB().isSupportsInlineDistinct()) {
10388 query.append(_ORDER_BY_ENTITY_ALIAS);
10389 }
10390 else {
10391 query.append(_ORDER_BY_ENTITY_TABLE);
10392 }
10393
10394 query.append(orderByFields[i]);
10395
10396 if ((i + 1) < orderByFields.length) {
10397 if (orderByComparator.isAscending() ^ previous) {
10398 query.append(ORDER_BY_ASC_HAS_NEXT);
10399 }
10400 else {
10401 query.append(ORDER_BY_DESC_HAS_NEXT);
10402 }
10403 }
10404 else {
10405 if (orderByComparator.isAscending() ^ previous) {
10406 query.append(ORDER_BY_ASC);
10407 }
10408 else {
10409 query.append(ORDER_BY_DESC);
10410 }
10411 }
10412 }
10413 }
10414
10415 else {
10416 if (getDB().isSupportsInlineDistinct()) {
10417 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
10418 }
10419 else {
10420 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
10421 }
10422 }
10423
10424 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10425 JournalArticle.class.getName(),
10426 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10427
10428 SQLQuery q = session.createSQLQuery(sql);
10429
10430 q.setFirstResult(0);
10431 q.setMaxResults(2);
10432
10433 if (getDB().isSupportsInlineDistinct()) {
10434 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
10435 }
10436 else {
10437 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
10438 }
10439
10440 QueryPos qPos = QueryPos.getInstance(q);
10441
10442 qPos.add(groupId);
10443
10444 qPos.add(status);
10445
10446 if (orderByComparator != null) {
10447 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
10448
10449 for (Object value : values) {
10450 qPos.add(value);
10451 }
10452 }
10453
10454 List<JournalArticle> list = q.list();
10455
10456 if (list.size() == 2) {
10457 return list.get(1);
10458 }
10459 else {
10460 return null;
10461 }
10462 }
10463
10464
10472 public List<JournalArticle> findByC_V(long companyId, double version)
10473 throws SystemException {
10474 return findByC_V(companyId, version, QueryUtil.ALL_POS,
10475 QueryUtil.ALL_POS, null);
10476 }
10477
10478
10492 public List<JournalArticle> findByC_V(long companyId, double version,
10493 int start, int end) throws SystemException {
10494 return findByC_V(companyId, version, start, end, null);
10495 }
10496
10497
10512 public List<JournalArticle> findByC_V(long companyId, double version,
10513 int start, int end, OrderByComparator orderByComparator)
10514 throws SystemException {
10515 FinderPath finderPath = null;
10516 Object[] finderArgs = null;
10517
10518 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
10519 (orderByComparator == null)) {
10520 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V;
10521 finderArgs = new Object[] { companyId, version };
10522 }
10523 else {
10524 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_V;
10525 finderArgs = new Object[] {
10526 companyId, version,
10527
10528 start, end, orderByComparator
10529 };
10530 }
10531
10532 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
10533 finderArgs, this);
10534
10535 if ((list != null) && !list.isEmpty()) {
10536 for (JournalArticle journalArticle : list) {
10537 if ((companyId != journalArticle.getCompanyId()) ||
10538 (version != journalArticle.getVersion())) {
10539 list = null;
10540
10541 break;
10542 }
10543 }
10544 }
10545
10546 if (list == null) {
10547 StringBundler query = null;
10548
10549 if (orderByComparator != null) {
10550 query = new StringBundler(4 +
10551 (orderByComparator.getOrderByFields().length * 3));
10552 }
10553 else {
10554 query = new StringBundler(4);
10555 }
10556
10557 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
10558
10559 query.append(_FINDER_COLUMN_C_V_COMPANYID_2);
10560
10561 query.append(_FINDER_COLUMN_C_V_VERSION_2);
10562
10563 if (orderByComparator != null) {
10564 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
10565 orderByComparator);
10566 }
10567
10568 else {
10569 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
10570 }
10571
10572 String sql = query.toString();
10573
10574 Session session = null;
10575
10576 try {
10577 session = openSession();
10578
10579 Query q = session.createQuery(sql);
10580
10581 QueryPos qPos = QueryPos.getInstance(q);
10582
10583 qPos.add(companyId);
10584
10585 qPos.add(version);
10586
10587 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
10588 start, end);
10589 }
10590 catch (Exception e) {
10591 throw processException(e);
10592 }
10593 finally {
10594 if (list == null) {
10595 FinderCacheUtil.removeResult(finderPath, finderArgs);
10596 }
10597 else {
10598 cacheResult(list);
10599
10600 FinderCacheUtil.putResult(finderPath, finderArgs, list);
10601 }
10602
10603 closeSession(session);
10604 }
10605 }
10606
10607 return list;
10608 }
10609
10610
10620 public JournalArticle findByC_V_First(long companyId, double version,
10621 OrderByComparator orderByComparator)
10622 throws NoSuchArticleException, SystemException {
10623 JournalArticle journalArticle = fetchByC_V_First(companyId, version,
10624 orderByComparator);
10625
10626 if (journalArticle != null) {
10627 return journalArticle;
10628 }
10629
10630 StringBundler msg = new StringBundler(6);
10631
10632 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
10633
10634 msg.append("companyId=");
10635 msg.append(companyId);
10636
10637 msg.append(", version=");
10638 msg.append(version);
10639
10640 msg.append(StringPool.CLOSE_CURLY_BRACE);
10641
10642 throw new NoSuchArticleException(msg.toString());
10643 }
10644
10645
10654 public JournalArticle fetchByC_V_First(long companyId, double version,
10655 OrderByComparator orderByComparator) throws SystemException {
10656 List<JournalArticle> list = findByC_V(companyId, version, 0, 1,
10657 orderByComparator);
10658
10659 if (!list.isEmpty()) {
10660 return list.get(0);
10661 }
10662
10663 return null;
10664 }
10665
10666
10676 public JournalArticle findByC_V_Last(long companyId, double version,
10677 OrderByComparator orderByComparator)
10678 throws NoSuchArticleException, SystemException {
10679 JournalArticle journalArticle = fetchByC_V_Last(companyId, version,
10680 orderByComparator);
10681
10682 if (journalArticle != null) {
10683 return journalArticle;
10684 }
10685
10686 StringBundler msg = new StringBundler(6);
10687
10688 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
10689
10690 msg.append("companyId=");
10691 msg.append(companyId);
10692
10693 msg.append(", version=");
10694 msg.append(version);
10695
10696 msg.append(StringPool.CLOSE_CURLY_BRACE);
10697
10698 throw new NoSuchArticleException(msg.toString());
10699 }
10700
10701
10710 public JournalArticle fetchByC_V_Last(long companyId, double version,
10711 OrderByComparator orderByComparator) throws SystemException {
10712 int count = countByC_V(companyId, version);
10713
10714 List<JournalArticle> list = findByC_V(companyId, version, count - 1,
10715 count, orderByComparator);
10716
10717 if (!list.isEmpty()) {
10718 return list.get(0);
10719 }
10720
10721 return null;
10722 }
10723
10724
10735 public JournalArticle[] findByC_V_PrevAndNext(long id, long companyId,
10736 double version, OrderByComparator orderByComparator)
10737 throws NoSuchArticleException, SystemException {
10738 JournalArticle journalArticle = findByPrimaryKey(id);
10739
10740 Session session = null;
10741
10742 try {
10743 session = openSession();
10744
10745 JournalArticle[] array = new JournalArticleImpl[3];
10746
10747 array[0] = getByC_V_PrevAndNext(session, journalArticle, companyId,
10748 version, orderByComparator, true);
10749
10750 array[1] = journalArticle;
10751
10752 array[2] = getByC_V_PrevAndNext(session, journalArticle, companyId,
10753 version, orderByComparator, false);
10754
10755 return array;
10756 }
10757 catch (Exception e) {
10758 throw processException(e);
10759 }
10760 finally {
10761 closeSession(session);
10762 }
10763 }
10764
10765 protected JournalArticle getByC_V_PrevAndNext(Session session,
10766 JournalArticle journalArticle, long companyId, double version,
10767 OrderByComparator orderByComparator, boolean previous) {
10768 StringBundler query = null;
10769
10770 if (orderByComparator != null) {
10771 query = new StringBundler(6 +
10772 (orderByComparator.getOrderByFields().length * 6));
10773 }
10774 else {
10775 query = new StringBundler(3);
10776 }
10777
10778 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
10779
10780 query.append(_FINDER_COLUMN_C_V_COMPANYID_2);
10781
10782 query.append(_FINDER_COLUMN_C_V_VERSION_2);
10783
10784 if (orderByComparator != null) {
10785 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
10786
10787 if (orderByConditionFields.length > 0) {
10788 query.append(WHERE_AND);
10789 }
10790
10791 for (int i = 0; i < orderByConditionFields.length; i++) {
10792 query.append(_ORDER_BY_ENTITY_ALIAS);
10793 query.append(orderByConditionFields[i]);
10794
10795 if ((i + 1) < orderByConditionFields.length) {
10796 if (orderByComparator.isAscending() ^ previous) {
10797 query.append(WHERE_GREATER_THAN_HAS_NEXT);
10798 }
10799 else {
10800 query.append(WHERE_LESSER_THAN_HAS_NEXT);
10801 }
10802 }
10803 else {
10804 if (orderByComparator.isAscending() ^ previous) {
10805 query.append(WHERE_GREATER_THAN);
10806 }
10807 else {
10808 query.append(WHERE_LESSER_THAN);
10809 }
10810 }
10811 }
10812
10813 query.append(ORDER_BY_CLAUSE);
10814
10815 String[] orderByFields = orderByComparator.getOrderByFields();
10816
10817 for (int i = 0; i < orderByFields.length; i++) {
10818 query.append(_ORDER_BY_ENTITY_ALIAS);
10819 query.append(orderByFields[i]);
10820
10821 if ((i + 1) < orderByFields.length) {
10822 if (orderByComparator.isAscending() ^ previous) {
10823 query.append(ORDER_BY_ASC_HAS_NEXT);
10824 }
10825 else {
10826 query.append(ORDER_BY_DESC_HAS_NEXT);
10827 }
10828 }
10829 else {
10830 if (orderByComparator.isAscending() ^ previous) {
10831 query.append(ORDER_BY_ASC);
10832 }
10833 else {
10834 query.append(ORDER_BY_DESC);
10835 }
10836 }
10837 }
10838 }
10839
10840 else {
10841 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
10842 }
10843
10844 String sql = query.toString();
10845
10846 Query q = session.createQuery(sql);
10847
10848 q.setFirstResult(0);
10849 q.setMaxResults(2);
10850
10851 QueryPos qPos = QueryPos.getInstance(q);
10852
10853 qPos.add(companyId);
10854
10855 qPos.add(version);
10856
10857 if (orderByComparator != null) {
10858 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
10859
10860 for (Object value : values) {
10861 qPos.add(value);
10862 }
10863 }
10864
10865 List<JournalArticle> list = q.list();
10866
10867 if (list.size() == 2) {
10868 return list.get(1);
10869 }
10870 else {
10871 return null;
10872 }
10873 }
10874
10875
10883 public List<JournalArticle> findByC_ST(long companyId, int status)
10884 throws SystemException {
10885 return findByC_ST(companyId, status, QueryUtil.ALL_POS,
10886 QueryUtil.ALL_POS, null);
10887 }
10888
10889
10903 public List<JournalArticle> findByC_ST(long companyId, int status,
10904 int start, int end) throws SystemException {
10905 return findByC_ST(companyId, status, start, end, null);
10906 }
10907
10908
10923 public List<JournalArticle> findByC_ST(long companyId, int status,
10924 int start, int end, OrderByComparator orderByComparator)
10925 throws SystemException {
10926 FinderPath finderPath = null;
10927 Object[] finderArgs = null;
10928
10929 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
10930 (orderByComparator == null)) {
10931 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_ST;
10932 finderArgs = new Object[] { companyId, status };
10933 }
10934 else {
10935 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_ST;
10936 finderArgs = new Object[] {
10937 companyId, status,
10938
10939 start, end, orderByComparator
10940 };
10941 }
10942
10943 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
10944 finderArgs, this);
10945
10946 if ((list != null) && !list.isEmpty()) {
10947 for (JournalArticle journalArticle : list) {
10948 if ((companyId != journalArticle.getCompanyId()) ||
10949 (status != journalArticle.getStatus())) {
10950 list = null;
10951
10952 break;
10953 }
10954 }
10955 }
10956
10957 if (list == null) {
10958 StringBundler query = null;
10959
10960 if (orderByComparator != null) {
10961 query = new StringBundler(4 +
10962 (orderByComparator.getOrderByFields().length * 3));
10963 }
10964 else {
10965 query = new StringBundler(4);
10966 }
10967
10968 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
10969
10970 query.append(_FINDER_COLUMN_C_ST_COMPANYID_2);
10971
10972 query.append(_FINDER_COLUMN_C_ST_STATUS_2);
10973
10974 if (orderByComparator != null) {
10975 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
10976 orderByComparator);
10977 }
10978
10979 else {
10980 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
10981 }
10982
10983 String sql = query.toString();
10984
10985 Session session = null;
10986
10987 try {
10988 session = openSession();
10989
10990 Query q = session.createQuery(sql);
10991
10992 QueryPos qPos = QueryPos.getInstance(q);
10993
10994 qPos.add(companyId);
10995
10996 qPos.add(status);
10997
10998 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
10999 start, end);
11000 }
11001 catch (Exception e) {
11002 throw processException(e);
11003 }
11004 finally {
11005 if (list == null) {
11006 FinderCacheUtil.removeResult(finderPath, finderArgs);
11007 }
11008 else {
11009 cacheResult(list);
11010
11011 FinderCacheUtil.putResult(finderPath, finderArgs, list);
11012 }
11013
11014 closeSession(session);
11015 }
11016 }
11017
11018 return list;
11019 }
11020
11021
11031 public JournalArticle findByC_ST_First(long companyId, int status,
11032 OrderByComparator orderByComparator)
11033 throws NoSuchArticleException, SystemException {
11034 JournalArticle journalArticle = fetchByC_ST_First(companyId, status,
11035 orderByComparator);
11036
11037 if (journalArticle != null) {
11038 return journalArticle;
11039 }
11040
11041 StringBundler msg = new StringBundler(6);
11042
11043 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
11044
11045 msg.append("companyId=");
11046 msg.append(companyId);
11047
11048 msg.append(", status=");
11049 msg.append(status);
11050
11051 msg.append(StringPool.CLOSE_CURLY_BRACE);
11052
11053 throw new NoSuchArticleException(msg.toString());
11054 }
11055
11056
11065 public JournalArticle fetchByC_ST_First(long companyId, int status,
11066 OrderByComparator orderByComparator) throws SystemException {
11067 List<JournalArticle> list = findByC_ST(companyId, status, 0, 1,
11068 orderByComparator);
11069
11070 if (!list.isEmpty()) {
11071 return list.get(0);
11072 }
11073
11074 return null;
11075 }
11076
11077
11087 public JournalArticle findByC_ST_Last(long companyId, int status,
11088 OrderByComparator orderByComparator)
11089 throws NoSuchArticleException, SystemException {
11090 JournalArticle journalArticle = fetchByC_ST_Last(companyId, status,
11091 orderByComparator);
11092
11093 if (journalArticle != null) {
11094 return journalArticle;
11095 }
11096
11097 StringBundler msg = new StringBundler(6);
11098
11099 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
11100
11101 msg.append("companyId=");
11102 msg.append(companyId);
11103
11104 msg.append(", status=");
11105 msg.append(status);
11106
11107 msg.append(StringPool.CLOSE_CURLY_BRACE);
11108
11109 throw new NoSuchArticleException(msg.toString());
11110 }
11111
11112
11121 public JournalArticle fetchByC_ST_Last(long companyId, int status,
11122 OrderByComparator orderByComparator) throws SystemException {
11123 int count = countByC_ST(companyId, status);
11124
11125 List<JournalArticle> list = findByC_ST(companyId, status, count - 1,
11126 count, orderByComparator);
11127
11128 if (!list.isEmpty()) {
11129 return list.get(0);
11130 }
11131
11132 return null;
11133 }
11134
11135
11146 public JournalArticle[] findByC_ST_PrevAndNext(long id, long companyId,
11147 int status, OrderByComparator orderByComparator)
11148 throws NoSuchArticleException, SystemException {
11149 JournalArticle journalArticle = findByPrimaryKey(id);
11150
11151 Session session = null;
11152
11153 try {
11154 session = openSession();
11155
11156 JournalArticle[] array = new JournalArticleImpl[3];
11157
11158 array[0] = getByC_ST_PrevAndNext(session, journalArticle,
11159 companyId, status, orderByComparator, true);
11160
11161 array[1] = journalArticle;
11162
11163 array[2] = getByC_ST_PrevAndNext(session, journalArticle,
11164 companyId, status, orderByComparator, false);
11165
11166 return array;
11167 }
11168 catch (Exception e) {
11169 throw processException(e);
11170 }
11171 finally {
11172 closeSession(session);
11173 }
11174 }
11175
11176 protected JournalArticle getByC_ST_PrevAndNext(Session session,
11177 JournalArticle journalArticle, long companyId, int status,
11178 OrderByComparator orderByComparator, boolean previous) {
11179 StringBundler query = null;
11180
11181 if (orderByComparator != null) {
11182 query = new StringBundler(6 +
11183 (orderByComparator.getOrderByFields().length * 6));
11184 }
11185 else {
11186 query = new StringBundler(3);
11187 }
11188
11189 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
11190
11191 query.append(_FINDER_COLUMN_C_ST_COMPANYID_2);
11192
11193 query.append(_FINDER_COLUMN_C_ST_STATUS_2);
11194
11195 if (orderByComparator != null) {
11196 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
11197
11198 if (orderByConditionFields.length > 0) {
11199 query.append(WHERE_AND);
11200 }
11201
11202 for (int i = 0; i < orderByConditionFields.length; i++) {
11203 query.append(_ORDER_BY_ENTITY_ALIAS);
11204 query.append(orderByConditionFields[i]);
11205
11206 if ((i + 1) < orderByConditionFields.length) {
11207 if (orderByComparator.isAscending() ^ previous) {
11208 query.append(WHERE_GREATER_THAN_HAS_NEXT);
11209 }
11210 else {
11211 query.append(WHERE_LESSER_THAN_HAS_NEXT);
11212 }
11213 }
11214 else {
11215 if (orderByComparator.isAscending() ^ previous) {
11216 query.append(WHERE_GREATER_THAN);
11217 }
11218 else {
11219 query.append(WHERE_LESSER_THAN);
11220 }
11221 }
11222 }
11223
11224 query.append(ORDER_BY_CLAUSE);
11225
11226 String[] orderByFields = orderByComparator.getOrderByFields();
11227
11228 for (int i = 0; i < orderByFields.length; i++) {
11229 query.append(_ORDER_BY_ENTITY_ALIAS);
11230 query.append(orderByFields[i]);
11231
11232 if ((i + 1) < orderByFields.length) {
11233 if (orderByComparator.isAscending() ^ previous) {
11234 query.append(ORDER_BY_ASC_HAS_NEXT);
11235 }
11236 else {
11237 query.append(ORDER_BY_DESC_HAS_NEXT);
11238 }
11239 }
11240 else {
11241 if (orderByComparator.isAscending() ^ previous) {
11242 query.append(ORDER_BY_ASC);
11243 }
11244 else {
11245 query.append(ORDER_BY_DESC);
11246 }
11247 }
11248 }
11249 }
11250
11251 else {
11252 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
11253 }
11254
11255 String sql = query.toString();
11256
11257 Query q = session.createQuery(sql);
11258
11259 q.setFirstResult(0);
11260 q.setMaxResults(2);
11261
11262 QueryPos qPos = QueryPos.getInstance(q);
11263
11264 qPos.add(companyId);
11265
11266 qPos.add(status);
11267
11268 if (orderByComparator != null) {
11269 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
11270
11271 for (Object value : values) {
11272 qPos.add(value);
11273 }
11274 }
11275
11276 List<JournalArticle> list = q.list();
11277
11278 if (list.size() == 2) {
11279 return list.get(1);
11280 }
11281 else {
11282 return null;
11283 }
11284 }
11285
11286
11295 public List<JournalArticle> findByG_C_C(long groupId, long classNameId,
11296 long classPK) throws SystemException {
11297 return findByG_C_C(groupId, classNameId, classPK, QueryUtil.ALL_POS,
11298 QueryUtil.ALL_POS, null);
11299 }
11300
11301
11316 public List<JournalArticle> findByG_C_C(long groupId, long classNameId,
11317 long classPK, int start, int end) throws SystemException {
11318 return findByG_C_C(groupId, classNameId, classPK, start, end, null);
11319 }
11320
11321
11337 public List<JournalArticle> findByG_C_C(long groupId, long classNameId,
11338 long classPK, int start, int end, OrderByComparator orderByComparator)
11339 throws SystemException {
11340 FinderPath finderPath = null;
11341 Object[] finderArgs = null;
11342
11343 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
11344 (orderByComparator == null)) {
11345 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_C;
11346 finderArgs = new Object[] { groupId, classNameId, classPK };
11347 }
11348 else {
11349 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_C_C;
11350 finderArgs = new Object[] {
11351 groupId, classNameId, classPK,
11352
11353 start, end, orderByComparator
11354 };
11355 }
11356
11357 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
11358 finderArgs, this);
11359
11360 if ((list != null) && !list.isEmpty()) {
11361 for (JournalArticle journalArticle : list) {
11362 if ((groupId != journalArticle.getGroupId()) ||
11363 (classNameId != journalArticle.getClassNameId()) ||
11364 (classPK != journalArticle.getClassPK())) {
11365 list = null;
11366
11367 break;
11368 }
11369 }
11370 }
11371
11372 if (list == null) {
11373 StringBundler query = null;
11374
11375 if (orderByComparator != null) {
11376 query = new StringBundler(5 +
11377 (orderByComparator.getOrderByFields().length * 3));
11378 }
11379 else {
11380 query = new StringBundler(5);
11381 }
11382
11383 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
11384
11385 query.append(_FINDER_COLUMN_G_C_C_GROUPID_2);
11386
11387 query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2);
11388
11389 query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2);
11390
11391 if (orderByComparator != null) {
11392 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
11393 orderByComparator);
11394 }
11395
11396 else {
11397 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
11398 }
11399
11400 String sql = query.toString();
11401
11402 Session session = null;
11403
11404 try {
11405 session = openSession();
11406
11407 Query q = session.createQuery(sql);
11408
11409 QueryPos qPos = QueryPos.getInstance(q);
11410
11411 qPos.add(groupId);
11412
11413 qPos.add(classNameId);
11414
11415 qPos.add(classPK);
11416
11417 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
11418 start, end);
11419 }
11420 catch (Exception e) {
11421 throw processException(e);
11422 }
11423 finally {
11424 if (list == null) {
11425 FinderCacheUtil.removeResult(finderPath, finderArgs);
11426 }
11427 else {
11428 cacheResult(list);
11429
11430 FinderCacheUtil.putResult(finderPath, finderArgs, list);
11431 }
11432
11433 closeSession(session);
11434 }
11435 }
11436
11437 return list;
11438 }
11439
11440
11451 public JournalArticle findByG_C_C_First(long groupId, long classNameId,
11452 long classPK, OrderByComparator orderByComparator)
11453 throws NoSuchArticleException, SystemException {
11454 JournalArticle journalArticle = fetchByG_C_C_First(groupId,
11455 classNameId, classPK, orderByComparator);
11456
11457 if (journalArticle != null) {
11458 return journalArticle;
11459 }
11460
11461 StringBundler msg = new StringBundler(8);
11462
11463 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
11464
11465 msg.append("groupId=");
11466 msg.append(groupId);
11467
11468 msg.append(", classNameId=");
11469 msg.append(classNameId);
11470
11471 msg.append(", classPK=");
11472 msg.append(classPK);
11473
11474 msg.append(StringPool.CLOSE_CURLY_BRACE);
11475
11476 throw new NoSuchArticleException(msg.toString());
11477 }
11478
11479
11489 public JournalArticle fetchByG_C_C_First(long groupId, long classNameId,
11490 long classPK, OrderByComparator orderByComparator)
11491 throws SystemException {
11492 List<JournalArticle> list = findByG_C_C(groupId, classNameId, classPK,
11493 0, 1, orderByComparator);
11494
11495 if (!list.isEmpty()) {
11496 return list.get(0);
11497 }
11498
11499 return null;
11500 }
11501
11502
11513 public JournalArticle findByG_C_C_Last(long groupId, long classNameId,
11514 long classPK, OrderByComparator orderByComparator)
11515 throws NoSuchArticleException, SystemException {
11516 JournalArticle journalArticle = fetchByG_C_C_Last(groupId, classNameId,
11517 classPK, orderByComparator);
11518
11519 if (journalArticle != null) {
11520 return journalArticle;
11521 }
11522
11523 StringBundler msg = new StringBundler(8);
11524
11525 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
11526
11527 msg.append("groupId=");
11528 msg.append(groupId);
11529
11530 msg.append(", classNameId=");
11531 msg.append(classNameId);
11532
11533 msg.append(", classPK=");
11534 msg.append(classPK);
11535
11536 msg.append(StringPool.CLOSE_CURLY_BRACE);
11537
11538 throw new NoSuchArticleException(msg.toString());
11539 }
11540
11541
11551 public JournalArticle fetchByG_C_C_Last(long groupId, long classNameId,
11552 long classPK, OrderByComparator orderByComparator)
11553 throws SystemException {
11554 int count = countByG_C_C(groupId, classNameId, classPK);
11555
11556 List<JournalArticle> list = findByG_C_C(groupId, classNameId, classPK,
11557 count - 1, count, orderByComparator);
11558
11559 if (!list.isEmpty()) {
11560 return list.get(0);
11561 }
11562
11563 return null;
11564 }
11565
11566
11578 public JournalArticle[] findByG_C_C_PrevAndNext(long id, long groupId,
11579 long classNameId, long classPK, OrderByComparator orderByComparator)
11580 throws NoSuchArticleException, SystemException {
11581 JournalArticle journalArticle = findByPrimaryKey(id);
11582
11583 Session session = null;
11584
11585 try {
11586 session = openSession();
11587
11588 JournalArticle[] array = new JournalArticleImpl[3];
11589
11590 array[0] = getByG_C_C_PrevAndNext(session, journalArticle, groupId,
11591 classNameId, classPK, orderByComparator, true);
11592
11593 array[1] = journalArticle;
11594
11595 array[2] = getByG_C_C_PrevAndNext(session, journalArticle, groupId,
11596 classNameId, classPK, orderByComparator, false);
11597
11598 return array;
11599 }
11600 catch (Exception e) {
11601 throw processException(e);
11602 }
11603 finally {
11604 closeSession(session);
11605 }
11606 }
11607
11608 protected JournalArticle getByG_C_C_PrevAndNext(Session session,
11609 JournalArticle journalArticle, long groupId, long classNameId,
11610 long classPK, OrderByComparator orderByComparator, boolean previous) {
11611 StringBundler query = null;
11612
11613 if (orderByComparator != null) {
11614 query = new StringBundler(6 +
11615 (orderByComparator.getOrderByFields().length * 6));
11616 }
11617 else {
11618 query = new StringBundler(3);
11619 }
11620
11621 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
11622
11623 query.append(_FINDER_COLUMN_G_C_C_GROUPID_2);
11624
11625 query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2);
11626
11627 query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2);
11628
11629 if (orderByComparator != null) {
11630 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
11631
11632 if (orderByConditionFields.length > 0) {
11633 query.append(WHERE_AND);
11634 }
11635
11636 for (int i = 0; i < orderByConditionFields.length; i++) {
11637 query.append(_ORDER_BY_ENTITY_ALIAS);
11638 query.append(orderByConditionFields[i]);
11639
11640 if ((i + 1) < orderByConditionFields.length) {
11641 if (orderByComparator.isAscending() ^ previous) {
11642 query.append(WHERE_GREATER_THAN_HAS_NEXT);
11643 }
11644 else {
11645 query.append(WHERE_LESSER_THAN_HAS_NEXT);
11646 }
11647 }
11648 else {
11649 if (orderByComparator.isAscending() ^ previous) {
11650 query.append(WHERE_GREATER_THAN);
11651 }
11652 else {
11653 query.append(WHERE_LESSER_THAN);
11654 }
11655 }
11656 }
11657
11658 query.append(ORDER_BY_CLAUSE);
11659
11660 String[] orderByFields = orderByComparator.getOrderByFields();
11661
11662 for (int i = 0; i < orderByFields.length; i++) {
11663 query.append(_ORDER_BY_ENTITY_ALIAS);
11664 query.append(orderByFields[i]);
11665
11666 if ((i + 1) < orderByFields.length) {
11667 if (orderByComparator.isAscending() ^ previous) {
11668 query.append(ORDER_BY_ASC_HAS_NEXT);
11669 }
11670 else {
11671 query.append(ORDER_BY_DESC_HAS_NEXT);
11672 }
11673 }
11674 else {
11675 if (orderByComparator.isAscending() ^ previous) {
11676 query.append(ORDER_BY_ASC);
11677 }
11678 else {
11679 query.append(ORDER_BY_DESC);
11680 }
11681 }
11682 }
11683 }
11684
11685 else {
11686 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
11687 }
11688
11689 String sql = query.toString();
11690
11691 Query q = session.createQuery(sql);
11692
11693 q.setFirstResult(0);
11694 q.setMaxResults(2);
11695
11696 QueryPos qPos = QueryPos.getInstance(q);
11697
11698 qPos.add(groupId);
11699
11700 qPos.add(classNameId);
11701
11702 qPos.add(classPK);
11703
11704 if (orderByComparator != null) {
11705 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
11706
11707 for (Object value : values) {
11708 qPos.add(value);
11709 }
11710 }
11711
11712 List<JournalArticle> list = q.list();
11713
11714 if (list.size() == 2) {
11715 return list.get(1);
11716 }
11717 else {
11718 return null;
11719 }
11720 }
11721
11722
11731 public List<JournalArticle> filterFindByG_C_C(long groupId,
11732 long classNameId, long classPK) throws SystemException {
11733 return filterFindByG_C_C(groupId, classNameId, classPK,
11734 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
11735 }
11736
11737
11752 public List<JournalArticle> filterFindByG_C_C(long groupId,
11753 long classNameId, long classPK, int start, int end)
11754 throws SystemException {
11755 return filterFindByG_C_C(groupId, classNameId, classPK, start, end, null);
11756 }
11757
11758
11774 public List<JournalArticle> filterFindByG_C_C(long groupId,
11775 long classNameId, long classPK, int start, int end,
11776 OrderByComparator orderByComparator) throws SystemException {
11777 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11778 return findByG_C_C(groupId, classNameId, classPK, start, end,
11779 orderByComparator);
11780 }
11781
11782 StringBundler query = null;
11783
11784 if (orderByComparator != null) {
11785 query = new StringBundler(5 +
11786 (orderByComparator.getOrderByFields().length * 3));
11787 }
11788 else {
11789 query = new StringBundler(5);
11790 }
11791
11792 if (getDB().isSupportsInlineDistinct()) {
11793 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
11794 }
11795 else {
11796 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
11797 }
11798
11799 query.append(_FINDER_COLUMN_G_C_C_GROUPID_2);
11800
11801 query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2);
11802
11803 query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2);
11804
11805 if (!getDB().isSupportsInlineDistinct()) {
11806 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
11807 }
11808
11809 if (orderByComparator != null) {
11810 if (getDB().isSupportsInlineDistinct()) {
11811 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
11812 orderByComparator);
11813 }
11814 else {
11815 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
11816 orderByComparator);
11817 }
11818 }
11819
11820 else {
11821 if (getDB().isSupportsInlineDistinct()) {
11822 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
11823 }
11824 else {
11825 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
11826 }
11827 }
11828
11829 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11830 JournalArticle.class.getName(),
11831 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11832
11833 Session session = null;
11834
11835 try {
11836 session = openSession();
11837
11838 SQLQuery q = session.createSQLQuery(sql);
11839
11840 if (getDB().isSupportsInlineDistinct()) {
11841 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
11842 }
11843 else {
11844 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
11845 }
11846
11847 QueryPos qPos = QueryPos.getInstance(q);
11848
11849 qPos.add(groupId);
11850
11851 qPos.add(classNameId);
11852
11853 qPos.add(classPK);
11854
11855 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
11856 end);
11857 }
11858 catch (Exception e) {
11859 throw processException(e);
11860 }
11861 finally {
11862 closeSession(session);
11863 }
11864 }
11865
11866
11878 public JournalArticle[] filterFindByG_C_C_PrevAndNext(long id,
11879 long groupId, long classNameId, long classPK,
11880 OrderByComparator orderByComparator)
11881 throws NoSuchArticleException, SystemException {
11882 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11883 return findByG_C_C_PrevAndNext(id, groupId, classNameId, classPK,
11884 orderByComparator);
11885 }
11886
11887 JournalArticle journalArticle = findByPrimaryKey(id);
11888
11889 Session session = null;
11890
11891 try {
11892 session = openSession();
11893
11894 JournalArticle[] array = new JournalArticleImpl[3];
11895
11896 array[0] = filterGetByG_C_C_PrevAndNext(session, journalArticle,
11897 groupId, classNameId, classPK, orderByComparator, true);
11898
11899 array[1] = journalArticle;
11900
11901 array[2] = filterGetByG_C_C_PrevAndNext(session, journalArticle,
11902 groupId, classNameId, classPK, orderByComparator, false);
11903
11904 return array;
11905 }
11906 catch (Exception e) {
11907 throw processException(e);
11908 }
11909 finally {
11910 closeSession(session);
11911 }
11912 }
11913
11914 protected JournalArticle filterGetByG_C_C_PrevAndNext(Session session,
11915 JournalArticle journalArticle, long groupId, long classNameId,
11916 long classPK, OrderByComparator orderByComparator, boolean previous) {
11917 StringBundler query = null;
11918
11919 if (orderByComparator != null) {
11920 query = new StringBundler(6 +
11921 (orderByComparator.getOrderByFields().length * 6));
11922 }
11923 else {
11924 query = new StringBundler(3);
11925 }
11926
11927 if (getDB().isSupportsInlineDistinct()) {
11928 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
11929 }
11930 else {
11931 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
11932 }
11933
11934 query.append(_FINDER_COLUMN_G_C_C_GROUPID_2);
11935
11936 query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2);
11937
11938 query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2);
11939
11940 if (!getDB().isSupportsInlineDistinct()) {
11941 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
11942 }
11943
11944 if (orderByComparator != null) {
11945 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
11946
11947 if (orderByConditionFields.length > 0) {
11948 query.append(WHERE_AND);
11949 }
11950
11951 for (int i = 0; i < orderByConditionFields.length; i++) {
11952 if (getDB().isSupportsInlineDistinct()) {
11953 query.append(_ORDER_BY_ENTITY_ALIAS);
11954 }
11955 else {
11956 query.append(_ORDER_BY_ENTITY_TABLE);
11957 }
11958
11959 query.append(orderByConditionFields[i]);
11960
11961 if ((i + 1) < orderByConditionFields.length) {
11962 if (orderByComparator.isAscending() ^ previous) {
11963 query.append(WHERE_GREATER_THAN_HAS_NEXT);
11964 }
11965 else {
11966 query.append(WHERE_LESSER_THAN_HAS_NEXT);
11967 }
11968 }
11969 else {
11970 if (orderByComparator.isAscending() ^ previous) {
11971 query.append(WHERE_GREATER_THAN);
11972 }
11973 else {
11974 query.append(WHERE_LESSER_THAN);
11975 }
11976 }
11977 }
11978
11979 query.append(ORDER_BY_CLAUSE);
11980
11981 String[] orderByFields = orderByComparator.getOrderByFields();
11982
11983 for (int i = 0; i < orderByFields.length; i++) {
11984 if (getDB().isSupportsInlineDistinct()) {
11985 query.append(_ORDER_BY_ENTITY_ALIAS);
11986 }
11987 else {
11988 query.append(_ORDER_BY_ENTITY_TABLE);
11989 }
11990
11991 query.append(orderByFields[i]);
11992
11993 if ((i + 1) < orderByFields.length) {
11994 if (orderByComparator.isAscending() ^ previous) {
11995 query.append(ORDER_BY_ASC_HAS_NEXT);
11996 }
11997 else {
11998 query.append(ORDER_BY_DESC_HAS_NEXT);
11999 }
12000 }
12001 else {
12002 if (orderByComparator.isAscending() ^ previous) {
12003 query.append(ORDER_BY_ASC);
12004 }
12005 else {
12006 query.append(ORDER_BY_DESC);
12007 }
12008 }
12009 }
12010 }
12011
12012 else {
12013 if (getDB().isSupportsInlineDistinct()) {
12014 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
12015 }
12016 else {
12017 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
12018 }
12019 }
12020
12021 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
12022 JournalArticle.class.getName(),
12023 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
12024
12025 SQLQuery q = session.createSQLQuery(sql);
12026
12027 q.setFirstResult(0);
12028 q.setMaxResults(2);
12029
12030 if (getDB().isSupportsInlineDistinct()) {
12031 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
12032 }
12033 else {
12034 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
12035 }
12036
12037 QueryPos qPos = QueryPos.getInstance(q);
12038
12039 qPos.add(groupId);
12040
12041 qPos.add(classNameId);
12042
12043 qPos.add(classPK);
12044
12045 if (orderByComparator != null) {
12046 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
12047
12048 for (Object value : values) {
12049 qPos.add(value);
12050 }
12051 }
12052
12053 List<JournalArticle> list = q.list();
12054
12055 if (list.size() == 2) {
12056 return list.get(1);
12057 }
12058 else {
12059 return null;
12060 }
12061 }
12062
12063
12073 public JournalArticle findByG_C_S(long groupId, long classNameId,
12074 String structureId) throws NoSuchArticleException, SystemException {
12075 JournalArticle journalArticle = fetchByG_C_S(groupId, classNameId,
12076 structureId);
12077
12078 if (journalArticle == null) {
12079 StringBundler msg = new StringBundler(8);
12080
12081 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
12082
12083 msg.append("groupId=");
12084 msg.append(groupId);
12085
12086 msg.append(", classNameId=");
12087 msg.append(classNameId);
12088
12089 msg.append(", structureId=");
12090 msg.append(structureId);
12091
12092 msg.append(StringPool.CLOSE_CURLY_BRACE);
12093
12094 if (_log.isWarnEnabled()) {
12095 _log.warn(msg.toString());
12096 }
12097
12098 throw new NoSuchArticleException(msg.toString());
12099 }
12100
12101 return journalArticle;
12102 }
12103
12104
12113 public JournalArticle fetchByG_C_S(long groupId, long classNameId,
12114 String structureId) throws SystemException {
12115 return fetchByG_C_S(groupId, classNameId, structureId, true);
12116 }
12117
12118
12128 public JournalArticle fetchByG_C_S(long groupId, long classNameId,
12129 String structureId, boolean retrieveFromCache)
12130 throws SystemException {
12131 Object[] finderArgs = new Object[] { groupId, classNameId, structureId };
12132
12133 Object result = null;
12134
12135 if (retrieveFromCache) {
12136 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_C_S,
12137 finderArgs, this);
12138 }
12139
12140 if (result instanceof JournalArticle) {
12141 JournalArticle journalArticle = (JournalArticle)result;
12142
12143 if ((groupId != journalArticle.getGroupId()) ||
12144 (classNameId != journalArticle.getClassNameId()) ||
12145 !Validator.equals(structureId,
12146 journalArticle.getStructureId())) {
12147 result = null;
12148 }
12149 }
12150
12151 if (result == null) {
12152 StringBundler query = new StringBundler(5);
12153
12154 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
12155
12156 query.append(_FINDER_COLUMN_G_C_S_GROUPID_2);
12157
12158 query.append(_FINDER_COLUMN_G_C_S_CLASSNAMEID_2);
12159
12160 if (structureId == null) {
12161 query.append(_FINDER_COLUMN_G_C_S_STRUCTUREID_1);
12162 }
12163 else {
12164 if (structureId.equals(StringPool.BLANK)) {
12165 query.append(_FINDER_COLUMN_G_C_S_STRUCTUREID_3);
12166 }
12167 else {
12168 query.append(_FINDER_COLUMN_G_C_S_STRUCTUREID_2);
12169 }
12170 }
12171
12172 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
12173
12174 String sql = query.toString();
12175
12176 Session session = null;
12177
12178 try {
12179 session = openSession();
12180
12181 Query q = session.createQuery(sql);
12182
12183 QueryPos qPos = QueryPos.getInstance(q);
12184
12185 qPos.add(groupId);
12186
12187 qPos.add(classNameId);
12188
12189 if (structureId != null) {
12190 qPos.add(structureId);
12191 }
12192
12193 List<JournalArticle> list = q.list();
12194
12195 result = list;
12196
12197 JournalArticle journalArticle = null;
12198
12199 if (list.isEmpty()) {
12200 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_S,
12201 finderArgs, list);
12202 }
12203 else {
12204 journalArticle = list.get(0);
12205
12206 cacheResult(journalArticle);
12207
12208 if ((journalArticle.getGroupId() != groupId) ||
12209 (journalArticle.getClassNameId() != classNameId) ||
12210 (journalArticle.getStructureId() == null) ||
12211 !journalArticle.getStructureId().equals(structureId)) {
12212 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_S,
12213 finderArgs, journalArticle);
12214 }
12215 }
12216
12217 return journalArticle;
12218 }
12219 catch (Exception e) {
12220 throw processException(e);
12221 }
12222 finally {
12223 if (result == null) {
12224 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_S,
12225 finderArgs);
12226 }
12227
12228 closeSession(session);
12229 }
12230 }
12231 else {
12232 if (result instanceof List<?>) {
12233 return null;
12234 }
12235 else {
12236 return (JournalArticle)result;
12237 }
12238 }
12239 }
12240
12241
12250 public List<JournalArticle> findByG_C_T(long groupId, long classNameId,
12251 String templateId) throws SystemException {
12252 return findByG_C_T(groupId, classNameId, templateId, QueryUtil.ALL_POS,
12253 QueryUtil.ALL_POS, null);
12254 }
12255
12256
12271 public List<JournalArticle> findByG_C_T(long groupId, long classNameId,
12272 String templateId, int start, int end) throws SystemException {
12273 return findByG_C_T(groupId, classNameId, templateId, start, end, null);
12274 }
12275
12276
12292 public List<JournalArticle> findByG_C_T(long groupId, long classNameId,
12293 String templateId, int start, int end,
12294 OrderByComparator orderByComparator) throws SystemException {
12295 FinderPath finderPath = null;
12296 Object[] finderArgs = null;
12297
12298 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
12299 (orderByComparator == null)) {
12300 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_T;
12301 finderArgs = new Object[] { groupId, classNameId, templateId };
12302 }
12303 else {
12304 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_C_T;
12305 finderArgs = new Object[] {
12306 groupId, classNameId, templateId,
12307
12308 start, end, orderByComparator
12309 };
12310 }
12311
12312 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
12313 finderArgs, this);
12314
12315 if ((list != null) && !list.isEmpty()) {
12316 for (JournalArticle journalArticle : list) {
12317 if ((groupId != journalArticle.getGroupId()) ||
12318 (classNameId != journalArticle.getClassNameId()) ||
12319 !Validator.equals(templateId,
12320 journalArticle.getTemplateId())) {
12321 list = null;
12322
12323 break;
12324 }
12325 }
12326 }
12327
12328 if (list == null) {
12329 StringBundler query = null;
12330
12331 if (orderByComparator != null) {
12332 query = new StringBundler(5 +
12333 (orderByComparator.getOrderByFields().length * 3));
12334 }
12335 else {
12336 query = new StringBundler(5);
12337 }
12338
12339 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
12340
12341 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
12342
12343 query.append(_FINDER_COLUMN_G_C_T_CLASSNAMEID_2);
12344
12345 if (templateId == null) {
12346 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_1);
12347 }
12348 else {
12349 if (templateId.equals(StringPool.BLANK)) {
12350 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_3);
12351 }
12352 else {
12353 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_2);
12354 }
12355 }
12356
12357 if (orderByComparator != null) {
12358 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
12359 orderByComparator);
12360 }
12361
12362 else {
12363 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
12364 }
12365
12366 String sql = query.toString();
12367
12368 Session session = null;
12369
12370 try {
12371 session = openSession();
12372
12373 Query q = session.createQuery(sql);
12374
12375 QueryPos qPos = QueryPos.getInstance(q);
12376
12377 qPos.add(groupId);
12378
12379 qPos.add(classNameId);
12380
12381 if (templateId != null) {
12382 qPos.add(templateId);
12383 }
12384
12385 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
12386 start, end);
12387 }
12388 catch (Exception e) {
12389 throw processException(e);
12390 }
12391 finally {
12392 if (list == null) {
12393 FinderCacheUtil.removeResult(finderPath, finderArgs);
12394 }
12395 else {
12396 cacheResult(list);
12397
12398 FinderCacheUtil.putResult(finderPath, finderArgs, list);
12399 }
12400
12401 closeSession(session);
12402 }
12403 }
12404
12405 return list;
12406 }
12407
12408
12419 public JournalArticle findByG_C_T_First(long groupId, long classNameId,
12420 String templateId, OrderByComparator orderByComparator)
12421 throws NoSuchArticleException, SystemException {
12422 JournalArticle journalArticle = fetchByG_C_T_First(groupId,
12423 classNameId, templateId, orderByComparator);
12424
12425 if (journalArticle != null) {
12426 return journalArticle;
12427 }
12428
12429 StringBundler msg = new StringBundler(8);
12430
12431 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
12432
12433 msg.append("groupId=");
12434 msg.append(groupId);
12435
12436 msg.append(", classNameId=");
12437 msg.append(classNameId);
12438
12439 msg.append(", templateId=");
12440 msg.append(templateId);
12441
12442 msg.append(StringPool.CLOSE_CURLY_BRACE);
12443
12444 throw new NoSuchArticleException(msg.toString());
12445 }
12446
12447
12457 public JournalArticle fetchByG_C_T_First(long groupId, long classNameId,
12458 String templateId, OrderByComparator orderByComparator)
12459 throws SystemException {
12460 List<JournalArticle> list = findByG_C_T(groupId, classNameId,
12461 templateId, 0, 1, orderByComparator);
12462
12463 if (!list.isEmpty()) {
12464 return list.get(0);
12465 }
12466
12467 return null;
12468 }
12469
12470
12481 public JournalArticle findByG_C_T_Last(long groupId, long classNameId,
12482 String templateId, OrderByComparator orderByComparator)
12483 throws NoSuchArticleException, SystemException {
12484 JournalArticle journalArticle = fetchByG_C_T_Last(groupId, classNameId,
12485 templateId, orderByComparator);
12486
12487 if (journalArticle != null) {
12488 return journalArticle;
12489 }
12490
12491 StringBundler msg = new StringBundler(8);
12492
12493 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
12494
12495 msg.append("groupId=");
12496 msg.append(groupId);
12497
12498 msg.append(", classNameId=");
12499 msg.append(classNameId);
12500
12501 msg.append(", templateId=");
12502 msg.append(templateId);
12503
12504 msg.append(StringPool.CLOSE_CURLY_BRACE);
12505
12506 throw new NoSuchArticleException(msg.toString());
12507 }
12508
12509
12519 public JournalArticle fetchByG_C_T_Last(long groupId, long classNameId,
12520 String templateId, OrderByComparator orderByComparator)
12521 throws SystemException {
12522 int count = countByG_C_T(groupId, classNameId, templateId);
12523
12524 List<JournalArticle> list = findByG_C_T(groupId, classNameId,
12525 templateId, count - 1, count, orderByComparator);
12526
12527 if (!list.isEmpty()) {
12528 return list.get(0);
12529 }
12530
12531 return null;
12532 }
12533
12534
12546 public JournalArticle[] findByG_C_T_PrevAndNext(long id, long groupId,
12547 long classNameId, String templateId, OrderByComparator orderByComparator)
12548 throws NoSuchArticleException, SystemException {
12549 JournalArticle journalArticle = findByPrimaryKey(id);
12550
12551 Session session = null;
12552
12553 try {
12554 session = openSession();
12555
12556 JournalArticle[] array = new JournalArticleImpl[3];
12557
12558 array[0] = getByG_C_T_PrevAndNext(session, journalArticle, groupId,
12559 classNameId, templateId, orderByComparator, true);
12560
12561 array[1] = journalArticle;
12562
12563 array[2] = getByG_C_T_PrevAndNext(session, journalArticle, groupId,
12564 classNameId, templateId, orderByComparator, false);
12565
12566 return array;
12567 }
12568 catch (Exception e) {
12569 throw processException(e);
12570 }
12571 finally {
12572 closeSession(session);
12573 }
12574 }
12575
12576 protected JournalArticle getByG_C_T_PrevAndNext(Session session,
12577 JournalArticle journalArticle, long groupId, long classNameId,
12578 String templateId, OrderByComparator orderByComparator, boolean previous) {
12579 StringBundler query = null;
12580
12581 if (orderByComparator != null) {
12582 query = new StringBundler(6 +
12583 (orderByComparator.getOrderByFields().length * 6));
12584 }
12585 else {
12586 query = new StringBundler(3);
12587 }
12588
12589 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
12590
12591 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
12592
12593 query.append(_FINDER_COLUMN_G_C_T_CLASSNAMEID_2);
12594
12595 if (templateId == null) {
12596 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_1);
12597 }
12598 else {
12599 if (templateId.equals(StringPool.BLANK)) {
12600 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_3);
12601 }
12602 else {
12603 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_2);
12604 }
12605 }
12606
12607 if (orderByComparator != null) {
12608 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
12609
12610 if (orderByConditionFields.length > 0) {
12611 query.append(WHERE_AND);
12612 }
12613
12614 for (int i = 0; i < orderByConditionFields.length; i++) {
12615 query.append(_ORDER_BY_ENTITY_ALIAS);
12616 query.append(orderByConditionFields[i]);
12617
12618 if ((i + 1) < orderByConditionFields.length) {
12619 if (orderByComparator.isAscending() ^ previous) {
12620 query.append(WHERE_GREATER_THAN_HAS_NEXT);
12621 }
12622 else {
12623 query.append(WHERE_LESSER_THAN_HAS_NEXT);
12624 }
12625 }
12626 else {
12627 if (orderByComparator.isAscending() ^ previous) {
12628 query.append(WHERE_GREATER_THAN);
12629 }
12630 else {
12631 query.append(WHERE_LESSER_THAN);
12632 }
12633 }
12634 }
12635
12636 query.append(ORDER_BY_CLAUSE);
12637
12638 String[] orderByFields = orderByComparator.getOrderByFields();
12639
12640 for (int i = 0; i < orderByFields.length; i++) {
12641 query.append(_ORDER_BY_ENTITY_ALIAS);
12642 query.append(orderByFields[i]);
12643
12644 if ((i + 1) < orderByFields.length) {
12645 if (orderByComparator.isAscending() ^ previous) {
12646 query.append(ORDER_BY_ASC_HAS_NEXT);
12647 }
12648 else {
12649 query.append(ORDER_BY_DESC_HAS_NEXT);
12650 }
12651 }
12652 else {
12653 if (orderByComparator.isAscending() ^ previous) {
12654 query.append(ORDER_BY_ASC);
12655 }
12656 else {
12657 query.append(ORDER_BY_DESC);
12658 }
12659 }
12660 }
12661 }
12662
12663 else {
12664 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
12665 }
12666
12667 String sql = query.toString();
12668
12669 Query q = session.createQuery(sql);
12670
12671 q.setFirstResult(0);
12672 q.setMaxResults(2);
12673
12674 QueryPos qPos = QueryPos.getInstance(q);
12675
12676 qPos.add(groupId);
12677
12678 qPos.add(classNameId);
12679
12680 if (templateId != null) {
12681 qPos.add(templateId);
12682 }
12683
12684 if (orderByComparator != null) {
12685 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
12686
12687 for (Object value : values) {
12688 qPos.add(value);
12689 }
12690 }
12691
12692 List<JournalArticle> list = q.list();
12693
12694 if (list.size() == 2) {
12695 return list.get(1);
12696 }
12697 else {
12698 return null;
12699 }
12700 }
12701
12702
12711 public List<JournalArticle> filterFindByG_C_T(long groupId,
12712 long classNameId, String templateId) throws SystemException {
12713 return filterFindByG_C_T(groupId, classNameId, templateId,
12714 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
12715 }
12716
12717
12732 public List<JournalArticle> filterFindByG_C_T(long groupId,
12733 long classNameId, String templateId, int start, int end)
12734 throws SystemException {
12735 return filterFindByG_C_T(groupId, classNameId, templateId, start, end,
12736 null);
12737 }
12738
12739
12755 public List<JournalArticle> filterFindByG_C_T(long groupId,
12756 long classNameId, String templateId, int start, int end,
12757 OrderByComparator orderByComparator) throws SystemException {
12758 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
12759 return findByG_C_T(groupId, classNameId, templateId, start, end,
12760 orderByComparator);
12761 }
12762
12763 StringBundler query = null;
12764
12765 if (orderByComparator != null) {
12766 query = new StringBundler(5 +
12767 (orderByComparator.getOrderByFields().length * 3));
12768 }
12769 else {
12770 query = new StringBundler(5);
12771 }
12772
12773 if (getDB().isSupportsInlineDistinct()) {
12774 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
12775 }
12776 else {
12777 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
12778 }
12779
12780 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
12781
12782 query.append(_FINDER_COLUMN_G_C_T_CLASSNAMEID_2);
12783
12784 if (templateId == null) {
12785 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_1);
12786 }
12787 else {
12788 if (templateId.equals(StringPool.BLANK)) {
12789 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_3);
12790 }
12791 else {
12792 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_2);
12793 }
12794 }
12795
12796 if (!getDB().isSupportsInlineDistinct()) {
12797 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
12798 }
12799
12800 if (orderByComparator != null) {
12801 if (getDB().isSupportsInlineDistinct()) {
12802 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
12803 orderByComparator);
12804 }
12805 else {
12806 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
12807 orderByComparator);
12808 }
12809 }
12810
12811 else {
12812 if (getDB().isSupportsInlineDistinct()) {
12813 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
12814 }
12815 else {
12816 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
12817 }
12818 }
12819
12820 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
12821 JournalArticle.class.getName(),
12822 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
12823
12824 Session session = null;
12825
12826 try {
12827 session = openSession();
12828
12829 SQLQuery q = session.createSQLQuery(sql);
12830
12831 if (getDB().isSupportsInlineDistinct()) {
12832 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
12833 }
12834 else {
12835 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
12836 }
12837
12838 QueryPos qPos = QueryPos.getInstance(q);
12839
12840 qPos.add(groupId);
12841
12842 qPos.add(classNameId);
12843
12844 if (templateId != null) {
12845 qPos.add(templateId);
12846 }
12847
12848 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
12849 end);
12850 }
12851 catch (Exception e) {
12852 throw processException(e);
12853 }
12854 finally {
12855 closeSession(session);
12856 }
12857 }
12858
12859
12871 public JournalArticle[] filterFindByG_C_T_PrevAndNext(long id,
12872 long groupId, long classNameId, String templateId,
12873 OrderByComparator orderByComparator)
12874 throws NoSuchArticleException, SystemException {
12875 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
12876 return findByG_C_T_PrevAndNext(id, groupId, classNameId,
12877 templateId, orderByComparator);
12878 }
12879
12880 JournalArticle journalArticle = findByPrimaryKey(id);
12881
12882 Session session = null;
12883
12884 try {
12885 session = openSession();
12886
12887 JournalArticle[] array = new JournalArticleImpl[3];
12888
12889 array[0] = filterGetByG_C_T_PrevAndNext(session, journalArticle,
12890 groupId, classNameId, templateId, orderByComparator, true);
12891
12892 array[1] = journalArticle;
12893
12894 array[2] = filterGetByG_C_T_PrevAndNext(session, journalArticle,
12895 groupId, classNameId, templateId, orderByComparator, false);
12896
12897 return array;
12898 }
12899 catch (Exception e) {
12900 throw processException(e);
12901 }
12902 finally {
12903 closeSession(session);
12904 }
12905 }
12906
12907 protected JournalArticle filterGetByG_C_T_PrevAndNext(Session session,
12908 JournalArticle journalArticle, long groupId, long classNameId,
12909 String templateId, OrderByComparator orderByComparator, boolean previous) {
12910 StringBundler query = null;
12911
12912 if (orderByComparator != null) {
12913 query = new StringBundler(6 +
12914 (orderByComparator.getOrderByFields().length * 6));
12915 }
12916 else {
12917 query = new StringBundler(3);
12918 }
12919
12920 if (getDB().isSupportsInlineDistinct()) {
12921 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
12922 }
12923 else {
12924 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
12925 }
12926
12927 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
12928
12929 query.append(_FINDER_COLUMN_G_C_T_CLASSNAMEID_2);
12930
12931 if (templateId == null) {
12932 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_1);
12933 }
12934 else {
12935 if (templateId.equals(StringPool.BLANK)) {
12936 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_3);
12937 }
12938 else {
12939 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_2);
12940 }
12941 }
12942
12943 if (!getDB().isSupportsInlineDistinct()) {
12944 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
12945 }
12946
12947 if (orderByComparator != null) {
12948 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
12949
12950 if (orderByConditionFields.length > 0) {
12951 query.append(WHERE_AND);
12952 }
12953
12954 for (int i = 0; i < orderByConditionFields.length; i++) {
12955 if (getDB().isSupportsInlineDistinct()) {
12956 query.append(_ORDER_BY_ENTITY_ALIAS);
12957 }
12958 else {
12959 query.append(_ORDER_BY_ENTITY_TABLE);
12960 }
12961
12962 query.append(orderByConditionFields[i]);
12963
12964 if ((i + 1) < orderByConditionFields.length) {
12965 if (orderByComparator.isAscending() ^ previous) {
12966 query.append(WHERE_GREATER_THAN_HAS_NEXT);
12967 }
12968 else {
12969 query.append(WHERE_LESSER_THAN_HAS_NEXT);
12970 }
12971 }
12972 else {
12973 if (orderByComparator.isAscending() ^ previous) {
12974 query.append(WHERE_GREATER_THAN);
12975 }
12976 else {
12977 query.append(WHERE_LESSER_THAN);
12978 }
12979 }
12980 }
12981
12982 query.append(ORDER_BY_CLAUSE);
12983
12984 String[] orderByFields = orderByComparator.getOrderByFields();
12985
12986 for (int i = 0; i < orderByFields.length; i++) {
12987 if (getDB().isSupportsInlineDistinct()) {
12988 query.append(_ORDER_BY_ENTITY_ALIAS);
12989 }
12990 else {
12991 query.append(_ORDER_BY_ENTITY_TABLE);
12992 }
12993
12994 query.append(orderByFields[i]);
12995
12996 if ((i + 1) < orderByFields.length) {
12997 if (orderByComparator.isAscending() ^ previous) {
12998 query.append(ORDER_BY_ASC_HAS_NEXT);
12999 }
13000 else {
13001 query.append(ORDER_BY_DESC_HAS_NEXT);
13002 }
13003 }
13004 else {
13005 if (orderByComparator.isAscending() ^ previous) {
13006 query.append(ORDER_BY_ASC);
13007 }
13008 else {
13009 query.append(ORDER_BY_DESC);
13010 }
13011 }
13012 }
13013 }
13014
13015 else {
13016 if (getDB().isSupportsInlineDistinct()) {
13017 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
13018 }
13019 else {
13020 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
13021 }
13022 }
13023
13024 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
13025 JournalArticle.class.getName(),
13026 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
13027
13028 SQLQuery q = session.createSQLQuery(sql);
13029
13030 q.setFirstResult(0);
13031 q.setMaxResults(2);
13032
13033 if (getDB().isSupportsInlineDistinct()) {
13034 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
13035 }
13036 else {
13037 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
13038 }
13039
13040 QueryPos qPos = QueryPos.getInstance(q);
13041
13042 qPos.add(groupId);
13043
13044 qPos.add(classNameId);
13045
13046 if (templateId != null) {
13047 qPos.add(templateId);
13048 }
13049
13050 if (orderByComparator != null) {
13051 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
13052
13053 for (Object value : values) {
13054 qPos.add(value);
13055 }
13056 }
13057
13058 List<JournalArticle> list = q.list();
13059
13060 if (list.size() == 2) {
13061 return list.get(1);
13062 }
13063 else {
13064 return null;
13065 }
13066 }
13067
13068
13077 public List<JournalArticle> findByG_C_L(long groupId, long classNameId,
13078 String layoutUuid) throws SystemException {
13079 return findByG_C_L(groupId, classNameId, layoutUuid, QueryUtil.ALL_POS,
13080 QueryUtil.ALL_POS, null);
13081 }
13082
13083
13098 public List<JournalArticle> findByG_C_L(long groupId, long classNameId,
13099 String layoutUuid, int start, int end) throws SystemException {
13100 return findByG_C_L(groupId, classNameId, layoutUuid, start, end, null);
13101 }
13102
13103
13119 public List<JournalArticle> findByG_C_L(long groupId, long classNameId,
13120 String layoutUuid, int start, int end,
13121 OrderByComparator orderByComparator) throws SystemException {
13122 FinderPath finderPath = null;
13123 Object[] finderArgs = null;
13124
13125 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
13126 (orderByComparator == null)) {
13127 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_L;
13128 finderArgs = new Object[] { groupId, classNameId, layoutUuid };
13129 }
13130 else {
13131 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_C_L;
13132 finderArgs = new Object[] {
13133 groupId, classNameId, layoutUuid,
13134
13135 start, end, orderByComparator
13136 };
13137 }
13138
13139 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
13140 finderArgs, this);
13141
13142 if ((list != null) && !list.isEmpty()) {
13143 for (JournalArticle journalArticle : list) {
13144 if ((groupId != journalArticle.getGroupId()) ||
13145 (classNameId != journalArticle.getClassNameId()) ||
13146 !Validator.equals(layoutUuid,
13147 journalArticle.getLayoutUuid())) {
13148 list = null;
13149
13150 break;
13151 }
13152 }
13153 }
13154
13155 if (list == null) {
13156 StringBundler query = null;
13157
13158 if (orderByComparator != null) {
13159 query = new StringBundler(5 +
13160 (orderByComparator.getOrderByFields().length * 3));
13161 }
13162 else {
13163 query = new StringBundler(5);
13164 }
13165
13166 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
13167
13168 query.append(_FINDER_COLUMN_G_C_L_GROUPID_2);
13169
13170 query.append(_FINDER_COLUMN_G_C_L_CLASSNAMEID_2);
13171
13172 if (layoutUuid == null) {
13173 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_1);
13174 }
13175 else {
13176 if (layoutUuid.equals(StringPool.BLANK)) {
13177 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_3);
13178 }
13179 else {
13180 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_2);
13181 }
13182 }
13183
13184 if (orderByComparator != null) {
13185 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
13186 orderByComparator);
13187 }
13188
13189 else {
13190 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
13191 }
13192
13193 String sql = query.toString();
13194
13195 Session session = null;
13196
13197 try {
13198 session = openSession();
13199
13200 Query q = session.createQuery(sql);
13201
13202 QueryPos qPos = QueryPos.getInstance(q);
13203
13204 qPos.add(groupId);
13205
13206 qPos.add(classNameId);
13207
13208 if (layoutUuid != null) {
13209 qPos.add(layoutUuid);
13210 }
13211
13212 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
13213 start, end);
13214 }
13215 catch (Exception e) {
13216 throw processException(e);
13217 }
13218 finally {
13219 if (list == null) {
13220 FinderCacheUtil.removeResult(finderPath, finderArgs);
13221 }
13222 else {
13223 cacheResult(list);
13224
13225 FinderCacheUtil.putResult(finderPath, finderArgs, list);
13226 }
13227
13228 closeSession(session);
13229 }
13230 }
13231
13232 return list;
13233 }
13234
13235
13246 public JournalArticle findByG_C_L_First(long groupId, long classNameId,
13247 String layoutUuid, OrderByComparator orderByComparator)
13248 throws NoSuchArticleException, SystemException {
13249 JournalArticle journalArticle = fetchByG_C_L_First(groupId,
13250 classNameId, layoutUuid, orderByComparator);
13251
13252 if (journalArticle != null) {
13253 return journalArticle;
13254 }
13255
13256 StringBundler msg = new StringBundler(8);
13257
13258 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
13259
13260 msg.append("groupId=");
13261 msg.append(groupId);
13262
13263 msg.append(", classNameId=");
13264 msg.append(classNameId);
13265
13266 msg.append(", layoutUuid=");
13267 msg.append(layoutUuid);
13268
13269 msg.append(StringPool.CLOSE_CURLY_BRACE);
13270
13271 throw new NoSuchArticleException(msg.toString());
13272 }
13273
13274
13284 public JournalArticle fetchByG_C_L_First(long groupId, long classNameId,
13285 String layoutUuid, OrderByComparator orderByComparator)
13286 throws SystemException {
13287 List<JournalArticle> list = findByG_C_L(groupId, classNameId,
13288 layoutUuid, 0, 1, orderByComparator);
13289
13290 if (!list.isEmpty()) {
13291 return list.get(0);
13292 }
13293
13294 return null;
13295 }
13296
13297
13308 public JournalArticle findByG_C_L_Last(long groupId, long classNameId,
13309 String layoutUuid, OrderByComparator orderByComparator)
13310 throws NoSuchArticleException, SystemException {
13311 JournalArticle journalArticle = fetchByG_C_L_Last(groupId, classNameId,
13312 layoutUuid, orderByComparator);
13313
13314 if (journalArticle != null) {
13315 return journalArticle;
13316 }
13317
13318 StringBundler msg = new StringBundler(8);
13319
13320 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
13321
13322 msg.append("groupId=");
13323 msg.append(groupId);
13324
13325 msg.append(", classNameId=");
13326 msg.append(classNameId);
13327
13328 msg.append(", layoutUuid=");
13329 msg.append(layoutUuid);
13330
13331 msg.append(StringPool.CLOSE_CURLY_BRACE);
13332
13333 throw new NoSuchArticleException(msg.toString());
13334 }
13335
13336
13346 public JournalArticle fetchByG_C_L_Last(long groupId, long classNameId,
13347 String layoutUuid, OrderByComparator orderByComparator)
13348 throws SystemException {
13349 int count = countByG_C_L(groupId, classNameId, layoutUuid);
13350
13351 List<JournalArticle> list = findByG_C_L(groupId, classNameId,
13352 layoutUuid, count - 1, count, orderByComparator);
13353
13354 if (!list.isEmpty()) {
13355 return list.get(0);
13356 }
13357
13358 return null;
13359 }
13360
13361
13373 public JournalArticle[] findByG_C_L_PrevAndNext(long id, long groupId,
13374 long classNameId, String layoutUuid, OrderByComparator orderByComparator)
13375 throws NoSuchArticleException, SystemException {
13376 JournalArticle journalArticle = findByPrimaryKey(id);
13377
13378 Session session = null;
13379
13380 try {
13381 session = openSession();
13382
13383 JournalArticle[] array = new JournalArticleImpl[3];
13384
13385 array[0] = getByG_C_L_PrevAndNext(session, journalArticle, groupId,
13386 classNameId, layoutUuid, orderByComparator, true);
13387
13388 array[1] = journalArticle;
13389
13390 array[2] = getByG_C_L_PrevAndNext(session, journalArticle, groupId,
13391 classNameId, layoutUuid, orderByComparator, false);
13392
13393 return array;
13394 }
13395 catch (Exception e) {
13396 throw processException(e);
13397 }
13398 finally {
13399 closeSession(session);
13400 }
13401 }
13402
13403 protected JournalArticle getByG_C_L_PrevAndNext(Session session,
13404 JournalArticle journalArticle, long groupId, long classNameId,
13405 String layoutUuid, OrderByComparator orderByComparator, boolean previous) {
13406 StringBundler query = null;
13407
13408 if (orderByComparator != null) {
13409 query = new StringBundler(6 +
13410 (orderByComparator.getOrderByFields().length * 6));
13411 }
13412 else {
13413 query = new StringBundler(3);
13414 }
13415
13416 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
13417
13418 query.append(_FINDER_COLUMN_G_C_L_GROUPID_2);
13419
13420 query.append(_FINDER_COLUMN_G_C_L_CLASSNAMEID_2);
13421
13422 if (layoutUuid == null) {
13423 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_1);
13424 }
13425 else {
13426 if (layoutUuid.equals(StringPool.BLANK)) {
13427 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_3);
13428 }
13429 else {
13430 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_2);
13431 }
13432 }
13433
13434 if (orderByComparator != null) {
13435 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
13436
13437 if (orderByConditionFields.length > 0) {
13438 query.append(WHERE_AND);
13439 }
13440
13441 for (int i = 0; i < orderByConditionFields.length; i++) {
13442 query.append(_ORDER_BY_ENTITY_ALIAS);
13443 query.append(orderByConditionFields[i]);
13444
13445 if ((i + 1) < orderByConditionFields.length) {
13446 if (orderByComparator.isAscending() ^ previous) {
13447 query.append(WHERE_GREATER_THAN_HAS_NEXT);
13448 }
13449 else {
13450 query.append(WHERE_LESSER_THAN_HAS_NEXT);
13451 }
13452 }
13453 else {
13454 if (orderByComparator.isAscending() ^ previous) {
13455 query.append(WHERE_GREATER_THAN);
13456 }
13457 else {
13458 query.append(WHERE_LESSER_THAN);
13459 }
13460 }
13461 }
13462
13463 query.append(ORDER_BY_CLAUSE);
13464
13465 String[] orderByFields = orderByComparator.getOrderByFields();
13466
13467 for (int i = 0; i < orderByFields.length; i++) {
13468 query.append(_ORDER_BY_ENTITY_ALIAS);
13469 query.append(orderByFields[i]);
13470
13471 if ((i + 1) < orderByFields.length) {
13472 if (orderByComparator.isAscending() ^ previous) {
13473 query.append(ORDER_BY_ASC_HAS_NEXT);
13474 }
13475 else {
13476 query.append(ORDER_BY_DESC_HAS_NEXT);
13477 }
13478 }
13479 else {
13480 if (orderByComparator.isAscending() ^ previous) {
13481 query.append(ORDER_BY_ASC);
13482 }
13483 else {
13484 query.append(ORDER_BY_DESC);
13485 }
13486 }
13487 }
13488 }
13489
13490 else {
13491 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
13492 }
13493
13494 String sql = query.toString();
13495
13496 Query q = session.createQuery(sql);
13497
13498 q.setFirstResult(0);
13499 q.setMaxResults(2);
13500
13501 QueryPos qPos = QueryPos.getInstance(q);
13502
13503 qPos.add(groupId);
13504
13505 qPos.add(classNameId);
13506
13507 if (layoutUuid != null) {
13508 qPos.add(layoutUuid);
13509 }
13510
13511 if (orderByComparator != null) {
13512 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
13513
13514 for (Object value : values) {
13515 qPos.add(value);
13516 }
13517 }
13518
13519 List<JournalArticle> list = q.list();
13520
13521 if (list.size() == 2) {
13522 return list.get(1);
13523 }
13524 else {
13525 return null;
13526 }
13527 }
13528
13529
13538 public List<JournalArticle> filterFindByG_C_L(long groupId,
13539 long classNameId, String layoutUuid) throws SystemException {
13540 return filterFindByG_C_L(groupId, classNameId, layoutUuid,
13541 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
13542 }
13543
13544
13559 public List<JournalArticle> filterFindByG_C_L(long groupId,
13560 long classNameId, String layoutUuid, int start, int end)
13561 throws SystemException {
13562 return filterFindByG_C_L(groupId, classNameId, layoutUuid, start, end,
13563 null);
13564 }
13565
13566
13582 public List<JournalArticle> filterFindByG_C_L(long groupId,
13583 long classNameId, String layoutUuid, int start, int end,
13584 OrderByComparator orderByComparator) throws SystemException {
13585 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
13586 return findByG_C_L(groupId, classNameId, layoutUuid, start, end,
13587 orderByComparator);
13588 }
13589
13590 StringBundler query = null;
13591
13592 if (orderByComparator != null) {
13593 query = new StringBundler(5 +
13594 (orderByComparator.getOrderByFields().length * 3));
13595 }
13596 else {
13597 query = new StringBundler(5);
13598 }
13599
13600 if (getDB().isSupportsInlineDistinct()) {
13601 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
13602 }
13603 else {
13604 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
13605 }
13606
13607 query.append(_FINDER_COLUMN_G_C_L_GROUPID_2);
13608
13609 query.append(_FINDER_COLUMN_G_C_L_CLASSNAMEID_2);
13610
13611 if (layoutUuid == null) {
13612 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_1);
13613 }
13614 else {
13615 if (layoutUuid.equals(StringPool.BLANK)) {
13616 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_3);
13617 }
13618 else {
13619 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_2);
13620 }
13621 }
13622
13623 if (!getDB().isSupportsInlineDistinct()) {
13624 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
13625 }
13626
13627 if (orderByComparator != null) {
13628 if (getDB().isSupportsInlineDistinct()) {
13629 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
13630 orderByComparator);
13631 }
13632 else {
13633 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
13634 orderByComparator);
13635 }
13636 }
13637
13638 else {
13639 if (getDB().isSupportsInlineDistinct()) {
13640 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
13641 }
13642 else {
13643 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
13644 }
13645 }
13646
13647 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
13648 JournalArticle.class.getName(),
13649 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
13650
13651 Session session = null;
13652
13653 try {
13654 session = openSession();
13655
13656 SQLQuery q = session.createSQLQuery(sql);
13657
13658 if (getDB().isSupportsInlineDistinct()) {
13659 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
13660 }
13661 else {
13662 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
13663 }
13664
13665 QueryPos qPos = QueryPos.getInstance(q);
13666
13667 qPos.add(groupId);
13668
13669 qPos.add(classNameId);
13670
13671 if (layoutUuid != null) {
13672 qPos.add(layoutUuid);
13673 }
13674
13675 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
13676 end);
13677 }
13678 catch (Exception e) {
13679 throw processException(e);
13680 }
13681 finally {
13682 closeSession(session);
13683 }
13684 }
13685
13686
13698 public JournalArticle[] filterFindByG_C_L_PrevAndNext(long id,
13699 long groupId, long classNameId, String layoutUuid,
13700 OrderByComparator orderByComparator)
13701 throws NoSuchArticleException, SystemException {
13702 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
13703 return findByG_C_L_PrevAndNext(id, groupId, classNameId,
13704 layoutUuid, orderByComparator);
13705 }
13706
13707 JournalArticle journalArticle = findByPrimaryKey(id);
13708
13709 Session session = null;
13710
13711 try {
13712 session = openSession();
13713
13714 JournalArticle[] array = new JournalArticleImpl[3];
13715
13716 array[0] = filterGetByG_C_L_PrevAndNext(session, journalArticle,
13717 groupId, classNameId, layoutUuid, orderByComparator, true);
13718
13719 array[1] = journalArticle;
13720
13721 array[2] = filterGetByG_C_L_PrevAndNext(session, journalArticle,
13722 groupId, classNameId, layoutUuid, orderByComparator, false);
13723
13724 return array;
13725 }
13726 catch (Exception e) {
13727 throw processException(e);
13728 }
13729 finally {
13730 closeSession(session);
13731 }
13732 }
13733
13734 protected JournalArticle filterGetByG_C_L_PrevAndNext(Session session,
13735 JournalArticle journalArticle, long groupId, long classNameId,
13736 String layoutUuid, OrderByComparator orderByComparator, boolean previous) {
13737 StringBundler query = null;
13738
13739 if (orderByComparator != null) {
13740 query = new StringBundler(6 +
13741 (orderByComparator.getOrderByFields().length * 6));
13742 }
13743 else {
13744 query = new StringBundler(3);
13745 }
13746
13747 if (getDB().isSupportsInlineDistinct()) {
13748 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
13749 }
13750 else {
13751 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
13752 }
13753
13754 query.append(_FINDER_COLUMN_G_C_L_GROUPID_2);
13755
13756 query.append(_FINDER_COLUMN_G_C_L_CLASSNAMEID_2);
13757
13758 if (layoutUuid == null) {
13759 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_1);
13760 }
13761 else {
13762 if (layoutUuid.equals(StringPool.BLANK)) {
13763 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_3);
13764 }
13765 else {
13766 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_2);
13767 }
13768 }
13769
13770 if (!getDB().isSupportsInlineDistinct()) {
13771 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
13772 }
13773
13774 if (orderByComparator != null) {
13775 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
13776
13777 if (orderByConditionFields.length > 0) {
13778 query.append(WHERE_AND);
13779 }
13780
13781 for (int i = 0; i < orderByConditionFields.length; i++) {
13782 if (getDB().isSupportsInlineDistinct()) {
13783 query.append(_ORDER_BY_ENTITY_ALIAS);
13784 }
13785 else {
13786 query.append(_ORDER_BY_ENTITY_TABLE);
13787 }
13788
13789 query.append(orderByConditionFields[i]);
13790
13791 if ((i + 1) < orderByConditionFields.length) {
13792 if (orderByComparator.isAscending() ^ previous) {
13793 query.append(WHERE_GREATER_THAN_HAS_NEXT);
13794 }
13795 else {
13796 query.append(WHERE_LESSER_THAN_HAS_NEXT);
13797 }
13798 }
13799 else {
13800 if (orderByComparator.isAscending() ^ previous) {
13801 query.append(WHERE_GREATER_THAN);
13802 }
13803 else {
13804 query.append(WHERE_LESSER_THAN);
13805 }
13806 }
13807 }
13808
13809 query.append(ORDER_BY_CLAUSE);
13810
13811 String[] orderByFields = orderByComparator.getOrderByFields();
13812
13813 for (int i = 0; i < orderByFields.length; i++) {
13814 if (getDB().isSupportsInlineDistinct()) {
13815 query.append(_ORDER_BY_ENTITY_ALIAS);
13816 }
13817 else {
13818 query.append(_ORDER_BY_ENTITY_TABLE);
13819 }
13820
13821 query.append(orderByFields[i]);
13822
13823 if ((i + 1) < orderByFields.length) {
13824 if (orderByComparator.isAscending() ^ previous) {
13825 query.append(ORDER_BY_ASC_HAS_NEXT);
13826 }
13827 else {
13828 query.append(ORDER_BY_DESC_HAS_NEXT);
13829 }
13830 }
13831 else {
13832 if (orderByComparator.isAscending() ^ previous) {
13833 query.append(ORDER_BY_ASC);
13834 }
13835 else {
13836 query.append(ORDER_BY_DESC);
13837 }
13838 }
13839 }
13840 }
13841
13842 else {
13843 if (getDB().isSupportsInlineDistinct()) {
13844 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
13845 }
13846 else {
13847 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
13848 }
13849 }
13850
13851 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
13852 JournalArticle.class.getName(),
13853 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
13854
13855 SQLQuery q = session.createSQLQuery(sql);
13856
13857 q.setFirstResult(0);
13858 q.setMaxResults(2);
13859
13860 if (getDB().isSupportsInlineDistinct()) {
13861 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
13862 }
13863 else {
13864 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
13865 }
13866
13867 QueryPos qPos = QueryPos.getInstance(q);
13868
13869 qPos.add(groupId);
13870
13871 qPos.add(classNameId);
13872
13873 if (layoutUuid != null) {
13874 qPos.add(layoutUuid);
13875 }
13876
13877 if (orderByComparator != null) {
13878 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
13879
13880 for (Object value : values) {
13881 qPos.add(value);
13882 }
13883 }
13884
13885 List<JournalArticle> list = q.list();
13886
13887 if (list.size() == 2) {
13888 return list.get(1);
13889 }
13890 else {
13891 return null;
13892 }
13893 }
13894
13895
13905 public JournalArticle findByG_A_V(long groupId, String articleId,
13906 double version) throws NoSuchArticleException, SystemException {
13907 JournalArticle journalArticle = fetchByG_A_V(groupId, articleId, version);
13908
13909 if (journalArticle == null) {
13910 StringBundler msg = new StringBundler(8);
13911
13912 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
13913
13914 msg.append("groupId=");
13915 msg.append(groupId);
13916
13917 msg.append(", articleId=");
13918 msg.append(articleId);
13919
13920 msg.append(", version=");
13921 msg.append(version);
13922
13923 msg.append(StringPool.CLOSE_CURLY_BRACE);
13924
13925 if (_log.isWarnEnabled()) {
13926 _log.warn(msg.toString());
13927 }
13928
13929 throw new NoSuchArticleException(msg.toString());
13930 }
13931
13932 return journalArticle;
13933 }
13934
13935
13944 public JournalArticle fetchByG_A_V(long groupId, String articleId,
13945 double version) throws SystemException {
13946 return fetchByG_A_V(groupId, articleId, version, true);
13947 }
13948
13949
13959 public JournalArticle fetchByG_A_V(long groupId, String articleId,
13960 double version, boolean retrieveFromCache) throws SystemException {
13961 Object[] finderArgs = new Object[] { groupId, articleId, version };
13962
13963 Object result = null;
13964
13965 if (retrieveFromCache) {
13966 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_A_V,
13967 finderArgs, this);
13968 }
13969
13970 if (result instanceof JournalArticle) {
13971 JournalArticle journalArticle = (JournalArticle)result;
13972
13973 if ((groupId != journalArticle.getGroupId()) ||
13974 !Validator.equals(articleId, journalArticle.getArticleId()) ||
13975 (version != journalArticle.getVersion())) {
13976 result = null;
13977 }
13978 }
13979
13980 if (result == null) {
13981 StringBundler query = new StringBundler(5);
13982
13983 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
13984
13985 query.append(_FINDER_COLUMN_G_A_V_GROUPID_2);
13986
13987 if (articleId == null) {
13988 query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_1);
13989 }
13990 else {
13991 if (articleId.equals(StringPool.BLANK)) {
13992 query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_3);
13993 }
13994 else {
13995 query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_2);
13996 }
13997 }
13998
13999 query.append(_FINDER_COLUMN_G_A_V_VERSION_2);
14000
14001 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
14002
14003 String sql = query.toString();
14004
14005 Session session = null;
14006
14007 try {
14008 session = openSession();
14009
14010 Query q = session.createQuery(sql);
14011
14012 QueryPos qPos = QueryPos.getInstance(q);
14013
14014 qPos.add(groupId);
14015
14016 if (articleId != null) {
14017 qPos.add(articleId);
14018 }
14019
14020 qPos.add(version);
14021
14022 List<JournalArticle> list = q.list();
14023
14024 result = list;
14025
14026 JournalArticle journalArticle = null;
14027
14028 if (list.isEmpty()) {
14029 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
14030 finderArgs, list);
14031 }
14032 else {
14033 journalArticle = list.get(0);
14034
14035 cacheResult(journalArticle);
14036
14037 if ((journalArticle.getGroupId() != groupId) ||
14038 (journalArticle.getArticleId() == null) ||
14039 !journalArticle.getArticleId().equals(articleId) ||
14040 (journalArticle.getVersion() != version)) {
14041 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
14042 finderArgs, journalArticle);
14043 }
14044 }
14045
14046 return journalArticle;
14047 }
14048 catch (Exception e) {
14049 throw processException(e);
14050 }
14051 finally {
14052 if (result == null) {
14053 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V,
14054 finderArgs);
14055 }
14056
14057 closeSession(session);
14058 }
14059 }
14060 else {
14061 if (result instanceof List<?>) {
14062 return null;
14063 }
14064 else {
14065 return (JournalArticle)result;
14066 }
14067 }
14068 }
14069
14070
14079 public List<JournalArticle> findByG_A_ST(long groupId, String articleId,
14080 int status) throws SystemException {
14081 return findByG_A_ST(groupId, articleId, status, QueryUtil.ALL_POS,
14082 QueryUtil.ALL_POS, null);
14083 }
14084
14085
14100 public List<JournalArticle> findByG_A_ST(long groupId, String articleId,
14101 int status, int start, int end) throws SystemException {
14102 return findByG_A_ST(groupId, articleId, status, start, end, null);
14103 }
14104
14105
14121 public List<JournalArticle> findByG_A_ST(long groupId, String articleId,
14122 int status, int start, int end, OrderByComparator orderByComparator)
14123 throws SystemException {
14124 FinderPath finderPath = null;
14125 Object[] finderArgs = null;
14126
14127 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
14128 (orderByComparator == null)) {
14129 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_ST;
14130 finderArgs = new Object[] { groupId, articleId, status };
14131 }
14132 else {
14133 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_A_ST;
14134 finderArgs = new Object[] {
14135 groupId, articleId, status,
14136
14137 start, end, orderByComparator
14138 };
14139 }
14140
14141 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
14142 finderArgs, this);
14143
14144 if ((list != null) && !list.isEmpty()) {
14145 for (JournalArticle journalArticle : list) {
14146 if ((groupId != journalArticle.getGroupId()) ||
14147 !Validator.equals(articleId,
14148 journalArticle.getArticleId()) ||
14149 (status != journalArticle.getStatus())) {
14150 list = null;
14151
14152 break;
14153 }
14154 }
14155 }
14156
14157 if (list == null) {
14158 StringBundler query = null;
14159
14160 if (orderByComparator != null) {
14161 query = new StringBundler(5 +
14162 (orderByComparator.getOrderByFields().length * 3));
14163 }
14164 else {
14165 query = new StringBundler(5);
14166 }
14167
14168 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
14169
14170 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_2);
14171
14172 if (articleId == null) {
14173 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_1);
14174 }
14175 else {
14176 if (articleId.equals(StringPool.BLANK)) {
14177 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_3);
14178 }
14179 else {
14180 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_2);
14181 }
14182 }
14183
14184 query.append(_FINDER_COLUMN_G_A_ST_STATUS_2);
14185
14186 if (orderByComparator != null) {
14187 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
14188 orderByComparator);
14189 }
14190
14191 else {
14192 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
14193 }
14194
14195 String sql = query.toString();
14196
14197 Session session = null;
14198
14199 try {
14200 session = openSession();
14201
14202 Query q = session.createQuery(sql);
14203
14204 QueryPos qPos = QueryPos.getInstance(q);
14205
14206 qPos.add(groupId);
14207
14208 if (articleId != null) {
14209 qPos.add(articleId);
14210 }
14211
14212 qPos.add(status);
14213
14214 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
14215 start, end);
14216 }
14217 catch (Exception e) {
14218 throw processException(e);
14219 }
14220 finally {
14221 if (list == null) {
14222 FinderCacheUtil.removeResult(finderPath, finderArgs);
14223 }
14224 else {
14225 cacheResult(list);
14226
14227 FinderCacheUtil.putResult(finderPath, finderArgs, list);
14228 }
14229
14230 closeSession(session);
14231 }
14232 }
14233
14234 return list;
14235 }
14236
14237
14248 public JournalArticle findByG_A_ST_First(long groupId, String articleId,
14249 int status, OrderByComparator orderByComparator)
14250 throws NoSuchArticleException, SystemException {
14251 JournalArticle journalArticle = fetchByG_A_ST_First(groupId, articleId,
14252 status, orderByComparator);
14253
14254 if (journalArticle != null) {
14255 return journalArticle;
14256 }
14257
14258 StringBundler msg = new StringBundler(8);
14259
14260 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
14261
14262 msg.append("groupId=");
14263 msg.append(groupId);
14264
14265 msg.append(", articleId=");
14266 msg.append(articleId);
14267
14268 msg.append(", status=");
14269 msg.append(status);
14270
14271 msg.append(StringPool.CLOSE_CURLY_BRACE);
14272
14273 throw new NoSuchArticleException(msg.toString());
14274 }
14275
14276
14286 public JournalArticle fetchByG_A_ST_First(long groupId, String articleId,
14287 int status, OrderByComparator orderByComparator)
14288 throws SystemException {
14289 List<JournalArticle> list = findByG_A_ST(groupId, articleId, status, 0,
14290 1, orderByComparator);
14291
14292 if (!list.isEmpty()) {
14293 return list.get(0);
14294 }
14295
14296 return null;
14297 }
14298
14299
14310 public JournalArticle findByG_A_ST_Last(long groupId, String articleId,
14311 int status, OrderByComparator orderByComparator)
14312 throws NoSuchArticleException, SystemException {
14313 JournalArticle journalArticle = fetchByG_A_ST_Last(groupId, articleId,
14314 status, orderByComparator);
14315
14316 if (journalArticle != null) {
14317 return journalArticle;
14318 }
14319
14320 StringBundler msg = new StringBundler(8);
14321
14322 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
14323
14324 msg.append("groupId=");
14325 msg.append(groupId);
14326
14327 msg.append(", articleId=");
14328 msg.append(articleId);
14329
14330 msg.append(", status=");
14331 msg.append(status);
14332
14333 msg.append(StringPool.CLOSE_CURLY_BRACE);
14334
14335 throw new NoSuchArticleException(msg.toString());
14336 }
14337
14338
14348 public JournalArticle fetchByG_A_ST_Last(long groupId, String articleId,
14349 int status, OrderByComparator orderByComparator)
14350 throws SystemException {
14351 int count = countByG_A_ST(groupId, articleId, status);
14352
14353 List<JournalArticle> list = findByG_A_ST(groupId, articleId, status,
14354 count - 1, count, orderByComparator);
14355
14356 if (!list.isEmpty()) {
14357 return list.get(0);
14358 }
14359
14360 return null;
14361 }
14362
14363
14375 public JournalArticle[] findByG_A_ST_PrevAndNext(long id, long groupId,
14376 String articleId, int status, OrderByComparator orderByComparator)
14377 throws NoSuchArticleException, SystemException {
14378 JournalArticle journalArticle = findByPrimaryKey(id);
14379
14380 Session session = null;
14381
14382 try {
14383 session = openSession();
14384
14385 JournalArticle[] array = new JournalArticleImpl[3];
14386
14387 array[0] = getByG_A_ST_PrevAndNext(session, journalArticle,
14388 groupId, articleId, status, orderByComparator, true);
14389
14390 array[1] = journalArticle;
14391
14392 array[2] = getByG_A_ST_PrevAndNext(session, journalArticle,
14393 groupId, articleId, status, orderByComparator, false);
14394
14395 return array;
14396 }
14397 catch (Exception e) {
14398 throw processException(e);
14399 }
14400 finally {
14401 closeSession(session);
14402 }
14403 }
14404
14405 protected JournalArticle getByG_A_ST_PrevAndNext(Session session,
14406 JournalArticle journalArticle, long groupId, String articleId,
14407 int status, OrderByComparator orderByComparator, boolean previous) {
14408 StringBundler query = null;
14409
14410 if (orderByComparator != null) {
14411 query = new StringBundler(6 +
14412 (orderByComparator.getOrderByFields().length * 6));
14413 }
14414 else {
14415 query = new StringBundler(3);
14416 }
14417
14418 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
14419
14420 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_2);
14421
14422 if (articleId == null) {
14423 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_1);
14424 }
14425 else {
14426 if (articleId.equals(StringPool.BLANK)) {
14427 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_3);
14428 }
14429 else {
14430 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_2);
14431 }
14432 }
14433
14434 query.append(_FINDER_COLUMN_G_A_ST_STATUS_2);
14435
14436 if (orderByComparator != null) {
14437 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
14438
14439 if (orderByConditionFields.length > 0) {
14440 query.append(WHERE_AND);
14441 }
14442
14443 for (int i = 0; i < orderByConditionFields.length; i++) {
14444 query.append(_ORDER_BY_ENTITY_ALIAS);
14445 query.append(orderByConditionFields[i]);
14446
14447 if ((i + 1) < orderByConditionFields.length) {
14448 if (orderByComparator.isAscending() ^ previous) {
14449 query.append(WHERE_GREATER_THAN_HAS_NEXT);
14450 }
14451 else {
14452 query.append(WHERE_LESSER_THAN_HAS_NEXT);
14453 }
14454 }
14455 else {
14456 if (orderByComparator.isAscending() ^ previous) {
14457 query.append(WHERE_GREATER_THAN);
14458 }
14459 else {
14460 query.append(WHERE_LESSER_THAN);
14461 }
14462 }
14463 }
14464
14465 query.append(ORDER_BY_CLAUSE);
14466
14467 String[] orderByFields = orderByComparator.getOrderByFields();
14468
14469 for (int i = 0; i < orderByFields.length; i++) {
14470 query.append(_ORDER_BY_ENTITY_ALIAS);
14471 query.append(orderByFields[i]);
14472
14473 if ((i + 1) < orderByFields.length) {
14474 if (orderByComparator.isAscending() ^ previous) {
14475 query.append(ORDER_BY_ASC_HAS_NEXT);
14476 }
14477 else {
14478 query.append(ORDER_BY_DESC_HAS_NEXT);
14479 }
14480 }
14481 else {
14482 if (orderByComparator.isAscending() ^ previous) {
14483 query.append(ORDER_BY_ASC);
14484 }
14485 else {
14486 query.append(ORDER_BY_DESC);
14487 }
14488 }
14489 }
14490 }
14491
14492 else {
14493 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
14494 }
14495
14496 String sql = query.toString();
14497
14498 Query q = session.createQuery(sql);
14499
14500 q.setFirstResult(0);
14501 q.setMaxResults(2);
14502
14503 QueryPos qPos = QueryPos.getInstance(q);
14504
14505 qPos.add(groupId);
14506
14507 if (articleId != null) {
14508 qPos.add(articleId);
14509 }
14510
14511 qPos.add(status);
14512
14513 if (orderByComparator != null) {
14514 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
14515
14516 for (Object value : values) {
14517 qPos.add(value);
14518 }
14519 }
14520
14521 List<JournalArticle> list = q.list();
14522
14523 if (list.size() == 2) {
14524 return list.get(1);
14525 }
14526 else {
14527 return null;
14528 }
14529 }
14530
14531
14544 public List<JournalArticle> findByG_A_ST(long groupId, String articleId,
14545 int[] statuses) throws SystemException {
14546 return findByG_A_ST(groupId, articleId, statuses, QueryUtil.ALL_POS,
14547 QueryUtil.ALL_POS, null);
14548 }
14549
14550
14565 public List<JournalArticle> findByG_A_ST(long groupId, String articleId,
14566 int[] statuses, int start, int end) throws SystemException {
14567 return findByG_A_ST(groupId, articleId, statuses, start, end, null);
14568 }
14569
14570
14586 public List<JournalArticle> findByG_A_ST(long groupId, String articleId,
14587 int[] statuses, int start, int end, OrderByComparator orderByComparator)
14588 throws SystemException {
14589 FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_A_ST;
14590 Object[] finderArgs = null;
14591
14592 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
14593 (orderByComparator == null)) {
14594 finderArgs = new Object[] {
14595 groupId, articleId, StringUtil.merge(statuses)
14596 };
14597 }
14598 else {
14599 finderArgs = new Object[] {
14600 groupId, articleId, StringUtil.merge(statuses),
14601
14602 start, end, orderByComparator
14603 };
14604 }
14605
14606 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
14607 finderArgs, this);
14608
14609 if ((list != null) && !list.isEmpty()) {
14610 for (JournalArticle journalArticle : list) {
14611 if ((groupId != journalArticle.getGroupId()) ||
14612 !Validator.equals(articleId,
14613 journalArticle.getArticleId()) ||
14614 !ArrayUtil.contains(statuses, journalArticle.getStatus())) {
14615 list = null;
14616
14617 break;
14618 }
14619 }
14620 }
14621
14622 if (list == null) {
14623 StringBundler query = new StringBundler();
14624
14625 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
14626
14627 boolean conjunctionable = false;
14628
14629 if (conjunctionable) {
14630 query.append(WHERE_AND);
14631 }
14632
14633 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_5);
14634
14635 conjunctionable = true;
14636
14637 if (conjunctionable) {
14638 query.append(WHERE_AND);
14639 }
14640
14641 if (articleId == null) {
14642 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_4);
14643 }
14644 else {
14645 if (articleId.equals(StringPool.BLANK)) {
14646 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_6);
14647 }
14648 else {
14649 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_5);
14650 }
14651 }
14652
14653 conjunctionable = true;
14654
14655 if ((statuses == null) || (statuses.length > 0)) {
14656 if (conjunctionable) {
14657 query.append(WHERE_AND);
14658 }
14659
14660 query.append(StringPool.OPEN_PARENTHESIS);
14661
14662 for (int i = 0; i < statuses.length; i++) {
14663 query.append(_FINDER_COLUMN_G_A_ST_STATUS_5);
14664
14665 if ((i + 1) < statuses.length) {
14666 query.append(WHERE_OR);
14667 }
14668 }
14669
14670 query.append(StringPool.CLOSE_PARENTHESIS);
14671
14672 conjunctionable = true;
14673 }
14674
14675 if (orderByComparator != null) {
14676 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
14677 orderByComparator);
14678 }
14679
14680 else {
14681 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
14682 }
14683
14684 String sql = query.toString();
14685
14686 Session session = null;
14687
14688 try {
14689 session = openSession();
14690
14691 Query q = session.createQuery(sql);
14692
14693 QueryPos qPos = QueryPos.getInstance(q);
14694
14695 qPos.add(groupId);
14696
14697 if (articleId != null) {
14698 qPos.add(articleId);
14699 }
14700
14701 if (statuses != null) {
14702 qPos.add(statuses);
14703 }
14704
14705 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
14706 start, end);
14707 }
14708 catch (Exception e) {
14709 throw processException(e);
14710 }
14711 finally {
14712 if (list == null) {
14713 FinderCacheUtil.removeResult(finderPath, finderArgs);
14714 }
14715 else {
14716 cacheResult(list);
14717
14718 FinderCacheUtil.putResult(finderPath, finderArgs, list);
14719 }
14720
14721 closeSession(session);
14722 }
14723 }
14724
14725 return list;
14726 }
14727
14728
14737 public List<JournalArticle> filterFindByG_A_ST(long groupId,
14738 String articleId, int status) throws SystemException {
14739 return filterFindByG_A_ST(groupId, articleId, status,
14740 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
14741 }
14742
14743
14758 public List<JournalArticle> filterFindByG_A_ST(long groupId,
14759 String articleId, int status, int start, int end)
14760 throws SystemException {
14761 return filterFindByG_A_ST(groupId, articleId, status, start, end, null);
14762 }
14763
14764
14780 public List<JournalArticle> filterFindByG_A_ST(long groupId,
14781 String articleId, int status, int start, int end,
14782 OrderByComparator orderByComparator) throws SystemException {
14783 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
14784 return findByG_A_ST(groupId, articleId, status, start, end,
14785 orderByComparator);
14786 }
14787
14788 StringBundler query = null;
14789
14790 if (orderByComparator != null) {
14791 query = new StringBundler(5 +
14792 (orderByComparator.getOrderByFields().length * 3));
14793 }
14794 else {
14795 query = new StringBundler(5);
14796 }
14797
14798 if (getDB().isSupportsInlineDistinct()) {
14799 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
14800 }
14801 else {
14802 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
14803 }
14804
14805 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_2);
14806
14807 if (articleId == null) {
14808 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_1);
14809 }
14810 else {
14811 if (articleId.equals(StringPool.BLANK)) {
14812 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_3);
14813 }
14814 else {
14815 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_2);
14816 }
14817 }
14818
14819 query.append(_FINDER_COLUMN_G_A_ST_STATUS_2);
14820
14821 if (!getDB().isSupportsInlineDistinct()) {
14822 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
14823 }
14824
14825 if (orderByComparator != null) {
14826 if (getDB().isSupportsInlineDistinct()) {
14827 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
14828 orderByComparator);
14829 }
14830 else {
14831 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
14832 orderByComparator);
14833 }
14834 }
14835
14836 else {
14837 if (getDB().isSupportsInlineDistinct()) {
14838 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
14839 }
14840 else {
14841 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
14842 }
14843 }
14844
14845 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
14846 JournalArticle.class.getName(),
14847 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
14848
14849 Session session = null;
14850
14851 try {
14852 session = openSession();
14853
14854 SQLQuery q = session.createSQLQuery(sql);
14855
14856 if (getDB().isSupportsInlineDistinct()) {
14857 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
14858 }
14859 else {
14860 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
14861 }
14862
14863 QueryPos qPos = QueryPos.getInstance(q);
14864
14865 qPos.add(groupId);
14866
14867 if (articleId != null) {
14868 qPos.add(articleId);
14869 }
14870
14871 qPos.add(status);
14872
14873 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
14874 end);
14875 }
14876 catch (Exception e) {
14877 throw processException(e);
14878 }
14879 finally {
14880 closeSession(session);
14881 }
14882 }
14883
14884
14896 public JournalArticle[] filterFindByG_A_ST_PrevAndNext(long id,
14897 long groupId, String articleId, int status,
14898 OrderByComparator orderByComparator)
14899 throws NoSuchArticleException, SystemException {
14900 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
14901 return findByG_A_ST_PrevAndNext(id, groupId, articleId, status,
14902 orderByComparator);
14903 }
14904
14905 JournalArticle journalArticle = findByPrimaryKey(id);
14906
14907 Session session = null;
14908
14909 try {
14910 session = openSession();
14911
14912 JournalArticle[] array = new JournalArticleImpl[3];
14913
14914 array[0] = filterGetByG_A_ST_PrevAndNext(session, journalArticle,
14915 groupId, articleId, status, orderByComparator, true);
14916
14917 array[1] = journalArticle;
14918
14919 array[2] = filterGetByG_A_ST_PrevAndNext(session, journalArticle,
14920 groupId, articleId, status, orderByComparator, false);
14921
14922 return array;
14923 }
14924 catch (Exception e) {
14925 throw processException(e);
14926 }
14927 finally {
14928 closeSession(session);
14929 }
14930 }
14931
14932 protected JournalArticle filterGetByG_A_ST_PrevAndNext(Session session,
14933 JournalArticle journalArticle, long groupId, String articleId,
14934 int status, OrderByComparator orderByComparator, boolean previous) {
14935 StringBundler query = null;
14936
14937 if (orderByComparator != null) {
14938 query = new StringBundler(6 +
14939 (orderByComparator.getOrderByFields().length * 6));
14940 }
14941 else {
14942 query = new StringBundler(3);
14943 }
14944
14945 if (getDB().isSupportsInlineDistinct()) {
14946 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
14947 }
14948 else {
14949 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
14950 }
14951
14952 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_2);
14953
14954 if (articleId == null) {
14955 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_1);
14956 }
14957 else {
14958 if (articleId.equals(StringPool.BLANK)) {
14959 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_3);
14960 }
14961 else {
14962 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_2);
14963 }
14964 }
14965
14966 query.append(_FINDER_COLUMN_G_A_ST_STATUS_2);
14967
14968 if (!getDB().isSupportsInlineDistinct()) {
14969 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
14970 }
14971
14972 if (orderByComparator != null) {
14973 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
14974
14975 if (orderByConditionFields.length > 0) {
14976 query.append(WHERE_AND);
14977 }
14978
14979 for (int i = 0; i < orderByConditionFields.length; i++) {
14980 if (getDB().isSupportsInlineDistinct()) {
14981 query.append(_ORDER_BY_ENTITY_ALIAS);
14982 }
14983 else {
14984 query.append(_ORDER_BY_ENTITY_TABLE);
14985 }
14986
14987 query.append(orderByConditionFields[i]);
14988
14989 if ((i + 1) < orderByConditionFields.length) {
14990 if (orderByComparator.isAscending() ^ previous) {
14991 query.append(WHERE_GREATER_THAN_HAS_NEXT);
14992 }
14993 else {
14994 query.append(WHERE_LESSER_THAN_HAS_NEXT);
14995 }
14996 }
14997 else {
14998 if (orderByComparator.isAscending() ^ previous) {
14999 query.append(WHERE_GREATER_THAN);
15000 }
15001 else {
15002 query.append(WHERE_LESSER_THAN);
15003 }
15004 }
15005 }
15006
15007 query.append(ORDER_BY_CLAUSE);
15008
15009 String[] orderByFields = orderByComparator.getOrderByFields();
15010
15011 for (int i = 0; i < orderByFields.length; i++) {
15012 if (getDB().isSupportsInlineDistinct()) {
15013 query.append(_ORDER_BY_ENTITY_ALIAS);
15014 }
15015 else {
15016 query.append(_ORDER_BY_ENTITY_TABLE);
15017 }
15018
15019 query.append(orderByFields[i]);
15020
15021 if ((i + 1) < orderByFields.length) {
15022 if (orderByComparator.isAscending() ^ previous) {
15023 query.append(ORDER_BY_ASC_HAS_NEXT);
15024 }
15025 else {
15026 query.append(ORDER_BY_DESC_HAS_NEXT);
15027 }
15028 }
15029 else {
15030 if (orderByComparator.isAscending() ^ previous) {
15031 query.append(ORDER_BY_ASC);
15032 }
15033 else {
15034 query.append(ORDER_BY_DESC);
15035 }
15036 }
15037 }
15038 }
15039
15040 else {
15041 if (getDB().isSupportsInlineDistinct()) {
15042 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
15043 }
15044 else {
15045 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
15046 }
15047 }
15048
15049 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
15050 JournalArticle.class.getName(),
15051 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
15052
15053 SQLQuery q = session.createSQLQuery(sql);
15054
15055 q.setFirstResult(0);
15056 q.setMaxResults(2);
15057
15058 if (getDB().isSupportsInlineDistinct()) {
15059 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
15060 }
15061 else {
15062 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
15063 }
15064
15065 QueryPos qPos = QueryPos.getInstance(q);
15066
15067 qPos.add(groupId);
15068
15069 if (articleId != null) {
15070 qPos.add(articleId);
15071 }
15072
15073 qPos.add(status);
15074
15075 if (orderByComparator != null) {
15076 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
15077
15078 for (Object value : values) {
15079 qPos.add(value);
15080 }
15081 }
15082
15083 List<JournalArticle> list = q.list();
15084
15085 if (list.size() == 2) {
15086 return list.get(1);
15087 }
15088 else {
15089 return null;
15090 }
15091 }
15092
15093
15102 public List<JournalArticle> filterFindByG_A_ST(long groupId,
15103 String articleId, int[] statuses) throws SystemException {
15104 return filterFindByG_A_ST(groupId, articleId, statuses,
15105 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
15106 }
15107
15108
15123 public List<JournalArticle> filterFindByG_A_ST(long groupId,
15124 String articleId, int[] statuses, int start, int end)
15125 throws SystemException {
15126 return filterFindByG_A_ST(groupId, articleId, statuses, start, end, null);
15127 }
15128
15129
15145 public List<JournalArticle> filterFindByG_A_ST(long groupId,
15146 String articleId, int[] statuses, int start, int end,
15147 OrderByComparator orderByComparator) throws SystemException {
15148 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
15149 return findByG_A_ST(groupId, articleId, statuses, start, end,
15150 orderByComparator);
15151 }
15152
15153 StringBundler query = new StringBundler();
15154
15155 if (getDB().isSupportsInlineDistinct()) {
15156 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
15157 }
15158 else {
15159 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
15160 }
15161
15162 boolean conjunctionable = false;
15163
15164 if (conjunctionable) {
15165 query.append(WHERE_AND);
15166 }
15167
15168 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_5);
15169
15170 conjunctionable = true;
15171
15172 if (conjunctionable) {
15173 query.append(WHERE_AND);
15174 }
15175
15176 if (articleId == null) {
15177 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_4);
15178 }
15179 else {
15180 if (articleId.equals(StringPool.BLANK)) {
15181 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_6);
15182 }
15183 else {
15184 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_5);
15185 }
15186 }
15187
15188 conjunctionable = true;
15189
15190 if ((statuses == null) || (statuses.length > 0)) {
15191 if (conjunctionable) {
15192 query.append(WHERE_AND);
15193 }
15194
15195 query.append(StringPool.OPEN_PARENTHESIS);
15196
15197 for (int i = 0; i < statuses.length; i++) {
15198 query.append(_FINDER_COLUMN_G_A_ST_STATUS_5);
15199
15200 if ((i + 1) < statuses.length) {
15201 query.append(WHERE_OR);
15202 }
15203 }
15204
15205 query.append(StringPool.CLOSE_PARENTHESIS);
15206
15207 conjunctionable = true;
15208 }
15209
15210 if (!getDB().isSupportsInlineDistinct()) {
15211 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
15212 }
15213
15214 if (orderByComparator != null) {
15215 if (getDB().isSupportsInlineDistinct()) {
15216 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
15217 orderByComparator);
15218 }
15219 else {
15220 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
15221 orderByComparator);
15222 }
15223 }
15224
15225 else {
15226 if (getDB().isSupportsInlineDistinct()) {
15227 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
15228 }
15229 else {
15230 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
15231 }
15232 }
15233
15234 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
15235 JournalArticle.class.getName(),
15236 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
15237
15238 Session session = null;
15239
15240 try {
15241 session = openSession();
15242
15243 SQLQuery q = session.createSQLQuery(sql);
15244
15245 if (getDB().isSupportsInlineDistinct()) {
15246 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
15247 }
15248 else {
15249 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
15250 }
15251
15252 QueryPos qPos = QueryPos.getInstance(q);
15253
15254 qPos.add(groupId);
15255
15256 if (articleId != null) {
15257 qPos.add(articleId);
15258 }
15259
15260 if (statuses != null) {
15261 qPos.add(statuses);
15262 }
15263
15264 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
15265 end);
15266 }
15267 catch (Exception e) {
15268 throw processException(e);
15269 }
15270 finally {
15271 closeSession(session);
15272 }
15273 }
15274
15275
15284 public List<JournalArticle> findByG_UT_ST(long groupId, String urlTitle,
15285 int status) throws SystemException {
15286 return findByG_UT_ST(groupId, urlTitle, status, QueryUtil.ALL_POS,
15287 QueryUtil.ALL_POS, null);
15288 }
15289
15290
15305 public List<JournalArticle> findByG_UT_ST(long groupId, String urlTitle,
15306 int status, int start, int end) throws SystemException {
15307 return findByG_UT_ST(groupId, urlTitle, status, start, end, null);
15308 }
15309
15310
15326 public List<JournalArticle> findByG_UT_ST(long groupId, String urlTitle,
15327 int status, int start, int end, OrderByComparator orderByComparator)
15328 throws SystemException {
15329 FinderPath finderPath = null;
15330 Object[] finderArgs = null;
15331
15332 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
15333 (orderByComparator == null)) {
15334 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_UT_ST;
15335 finderArgs = new Object[] { groupId, urlTitle, status };
15336 }
15337 else {
15338 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_UT_ST;
15339 finderArgs = new Object[] {
15340 groupId, urlTitle, status,
15341
15342 start, end, orderByComparator
15343 };
15344 }
15345
15346 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
15347 finderArgs, this);
15348
15349 if ((list != null) && !list.isEmpty()) {
15350 for (JournalArticle journalArticle : list) {
15351 if ((groupId != journalArticle.getGroupId()) ||
15352 !Validator.equals(urlTitle, journalArticle.getUrlTitle()) ||
15353 (status != journalArticle.getStatus())) {
15354 list = null;
15355
15356 break;
15357 }
15358 }
15359 }
15360
15361 if (list == null) {
15362 StringBundler query = null;
15363
15364 if (orderByComparator != null) {
15365 query = new StringBundler(5 +
15366 (orderByComparator.getOrderByFields().length * 3));
15367 }
15368 else {
15369 query = new StringBundler(5);
15370 }
15371
15372 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
15373
15374 query.append(_FINDER_COLUMN_G_UT_ST_GROUPID_2);
15375
15376 if (urlTitle == null) {
15377 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_1);
15378 }
15379 else {
15380 if (urlTitle.equals(StringPool.BLANK)) {
15381 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_3);
15382 }
15383 else {
15384 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_2);
15385 }
15386 }
15387
15388 query.append(_FINDER_COLUMN_G_UT_ST_STATUS_2);
15389
15390 if (orderByComparator != null) {
15391 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
15392 orderByComparator);
15393 }
15394
15395 else {
15396 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
15397 }
15398
15399 String sql = query.toString();
15400
15401 Session session = null;
15402
15403 try {
15404 session = openSession();
15405
15406 Query q = session.createQuery(sql);
15407
15408 QueryPos qPos = QueryPos.getInstance(q);
15409
15410 qPos.add(groupId);
15411
15412 if (urlTitle != null) {
15413 qPos.add(urlTitle);
15414 }
15415
15416 qPos.add(status);
15417
15418 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
15419 start, end);
15420 }
15421 catch (Exception e) {
15422 throw processException(e);
15423 }
15424 finally {
15425 if (list == null) {
15426 FinderCacheUtil.removeResult(finderPath, finderArgs);
15427 }
15428 else {
15429 cacheResult(list);
15430
15431 FinderCacheUtil.putResult(finderPath, finderArgs, list);
15432 }
15433
15434 closeSession(session);
15435 }
15436 }
15437
15438 return list;
15439 }
15440
15441
15452 public JournalArticle findByG_UT_ST_First(long groupId, String urlTitle,
15453 int status, OrderByComparator orderByComparator)
15454 throws NoSuchArticleException, SystemException {
15455 JournalArticle journalArticle = fetchByG_UT_ST_First(groupId, urlTitle,
15456 status, orderByComparator);
15457
15458 if (journalArticle != null) {
15459 return journalArticle;
15460 }
15461
15462 StringBundler msg = new StringBundler(8);
15463
15464 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
15465
15466 msg.append("groupId=");
15467 msg.append(groupId);
15468
15469 msg.append(", urlTitle=");
15470 msg.append(urlTitle);
15471
15472 msg.append(", status=");
15473 msg.append(status);
15474
15475 msg.append(StringPool.CLOSE_CURLY_BRACE);
15476
15477 throw new NoSuchArticleException(msg.toString());
15478 }
15479
15480
15490 public JournalArticle fetchByG_UT_ST_First(long groupId, String urlTitle,
15491 int status, OrderByComparator orderByComparator)
15492 throws SystemException {
15493 List<JournalArticle> list = findByG_UT_ST(groupId, urlTitle, status, 0,
15494 1, orderByComparator);
15495
15496 if (!list.isEmpty()) {
15497 return list.get(0);
15498 }
15499
15500 return null;
15501 }
15502
15503
15514 public JournalArticle findByG_UT_ST_Last(long groupId, String urlTitle,
15515 int status, OrderByComparator orderByComparator)
15516 throws NoSuchArticleException, SystemException {
15517 JournalArticle journalArticle = fetchByG_UT_ST_Last(groupId, urlTitle,
15518 status, orderByComparator);
15519
15520 if (journalArticle != null) {
15521 return journalArticle;
15522 }
15523
15524 StringBundler msg = new StringBundler(8);
15525
15526 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
15527
15528 msg.append("groupId=");
15529 msg.append(groupId);
15530
15531 msg.append(", urlTitle=");
15532 msg.append(urlTitle);
15533
15534 msg.append(", status=");
15535 msg.append(status);
15536
15537 msg.append(StringPool.CLOSE_CURLY_BRACE);
15538
15539 throw new NoSuchArticleException(msg.toString());
15540 }
15541
15542
15552 public JournalArticle fetchByG_UT_ST_Last(long groupId, String urlTitle,
15553 int status, OrderByComparator orderByComparator)
15554 throws SystemException {
15555 int count = countByG_UT_ST(groupId, urlTitle, status);
15556
15557 List<JournalArticle> list = findByG_UT_ST(groupId, urlTitle, status,
15558 count - 1, count, orderByComparator);
15559
15560 if (!list.isEmpty()) {
15561 return list.get(0);
15562 }
15563
15564 return null;
15565 }
15566
15567
15579 public JournalArticle[] findByG_UT_ST_PrevAndNext(long id, long groupId,
15580 String urlTitle, int status, OrderByComparator orderByComparator)
15581 throws NoSuchArticleException, SystemException {
15582 JournalArticle journalArticle = findByPrimaryKey(id);
15583
15584 Session session = null;
15585
15586 try {
15587 session = openSession();
15588
15589 JournalArticle[] array = new JournalArticleImpl[3];
15590
15591 array[0] = getByG_UT_ST_PrevAndNext(session, journalArticle,
15592 groupId, urlTitle, status, orderByComparator, true);
15593
15594 array[1] = journalArticle;
15595
15596 array[2] = getByG_UT_ST_PrevAndNext(session, journalArticle,
15597 groupId, urlTitle, status, orderByComparator, false);
15598
15599 return array;
15600 }
15601 catch (Exception e) {
15602 throw processException(e);
15603 }
15604 finally {
15605 closeSession(session);
15606 }
15607 }
15608
15609 protected JournalArticle getByG_UT_ST_PrevAndNext(Session session,
15610 JournalArticle journalArticle, long groupId, String urlTitle,
15611 int status, OrderByComparator orderByComparator, boolean previous) {
15612 StringBundler query = null;
15613
15614 if (orderByComparator != null) {
15615 query = new StringBundler(6 +
15616 (orderByComparator.getOrderByFields().length * 6));
15617 }
15618 else {
15619 query = new StringBundler(3);
15620 }
15621
15622 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
15623
15624 query.append(_FINDER_COLUMN_G_UT_ST_GROUPID_2);
15625
15626 if (urlTitle == null) {
15627 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_1);
15628 }
15629 else {
15630 if (urlTitle.equals(StringPool.BLANK)) {
15631 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_3);
15632 }
15633 else {
15634 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_2);
15635 }
15636 }
15637
15638 query.append(_FINDER_COLUMN_G_UT_ST_STATUS_2);
15639
15640 if (orderByComparator != null) {
15641 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
15642
15643 if (orderByConditionFields.length > 0) {
15644 query.append(WHERE_AND);
15645 }
15646
15647 for (int i = 0; i < orderByConditionFields.length; i++) {
15648 query.append(_ORDER_BY_ENTITY_ALIAS);
15649 query.append(orderByConditionFields[i]);
15650
15651 if ((i + 1) < orderByConditionFields.length) {
15652 if (orderByComparator.isAscending() ^ previous) {
15653 query.append(WHERE_GREATER_THAN_HAS_NEXT);
15654 }
15655 else {
15656 query.append(WHERE_LESSER_THAN_HAS_NEXT);
15657 }
15658 }
15659 else {
15660 if (orderByComparator.isAscending() ^ previous) {
15661 query.append(WHERE_GREATER_THAN);
15662 }
15663 else {
15664 query.append(WHERE_LESSER_THAN);
15665 }
15666 }
15667 }
15668
15669 query.append(ORDER_BY_CLAUSE);
15670
15671 String[] orderByFields = orderByComparator.getOrderByFields();
15672
15673 for (int i = 0; i < orderByFields.length; i++) {
15674 query.append(_ORDER_BY_ENTITY_ALIAS);
15675 query.append(orderByFields[i]);
15676
15677 if ((i + 1) < orderByFields.length) {
15678 if (orderByComparator.isAscending() ^ previous) {
15679 query.append(ORDER_BY_ASC_HAS_NEXT);
15680 }
15681 else {
15682 query.append(ORDER_BY_DESC_HAS_NEXT);
15683 }
15684 }
15685 else {
15686 if (orderByComparator.isAscending() ^ previous) {
15687 query.append(ORDER_BY_ASC);
15688 }
15689 else {
15690 query.append(ORDER_BY_DESC);
15691 }
15692 }
15693 }
15694 }
15695
15696 else {
15697 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
15698 }
15699
15700 String sql = query.toString();
15701
15702 Query q = session.createQuery(sql);
15703
15704 q.setFirstResult(0);
15705 q.setMaxResults(2);
15706
15707 QueryPos qPos = QueryPos.getInstance(q);
15708
15709 qPos.add(groupId);
15710
15711 if (urlTitle != null) {
15712 qPos.add(urlTitle);
15713 }
15714
15715 qPos.add(status);
15716
15717 if (orderByComparator != null) {
15718 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
15719
15720 for (Object value : values) {
15721 qPos.add(value);
15722 }
15723 }
15724
15725 List<JournalArticle> list = q.list();
15726
15727 if (list.size() == 2) {
15728 return list.get(1);
15729 }
15730 else {
15731 return null;
15732 }
15733 }
15734
15735
15744 public List<JournalArticle> filterFindByG_UT_ST(long groupId,
15745 String urlTitle, int status) throws SystemException {
15746 return filterFindByG_UT_ST(groupId, urlTitle, status,
15747 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
15748 }
15749
15750
15765 public List<JournalArticle> filterFindByG_UT_ST(long groupId,
15766 String urlTitle, int status, int start, int end)
15767 throws SystemException {
15768 return filterFindByG_UT_ST(groupId, urlTitle, status, start, end, null);
15769 }
15770
15771
15787 public List<JournalArticle> filterFindByG_UT_ST(long groupId,
15788 String urlTitle, int status, int start, int end,
15789 OrderByComparator orderByComparator) throws SystemException {
15790 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
15791 return findByG_UT_ST(groupId, urlTitle, status, start, end,
15792 orderByComparator);
15793 }
15794
15795 StringBundler query = null;
15796
15797 if (orderByComparator != null) {
15798 query = new StringBundler(5 +
15799 (orderByComparator.getOrderByFields().length * 3));
15800 }
15801 else {
15802 query = new StringBundler(5);
15803 }
15804
15805 if (getDB().isSupportsInlineDistinct()) {
15806 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
15807 }
15808 else {
15809 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
15810 }
15811
15812 query.append(_FINDER_COLUMN_G_UT_ST_GROUPID_2);
15813
15814 if (urlTitle == null) {
15815 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_1);
15816 }
15817 else {
15818 if (urlTitle.equals(StringPool.BLANK)) {
15819 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_3);
15820 }
15821 else {
15822 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_2);
15823 }
15824 }
15825
15826 query.append(_FINDER_COLUMN_G_UT_ST_STATUS_2);
15827
15828 if (!getDB().isSupportsInlineDistinct()) {
15829 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
15830 }
15831
15832 if (orderByComparator != null) {
15833 if (getDB().isSupportsInlineDistinct()) {
15834 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
15835 orderByComparator);
15836 }
15837 else {
15838 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
15839 orderByComparator);
15840 }
15841 }
15842
15843 else {
15844 if (getDB().isSupportsInlineDistinct()) {
15845 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
15846 }
15847 else {
15848 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
15849 }
15850 }
15851
15852 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
15853 JournalArticle.class.getName(),
15854 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
15855
15856 Session session = null;
15857
15858 try {
15859 session = openSession();
15860
15861 SQLQuery q = session.createSQLQuery(sql);
15862
15863 if (getDB().isSupportsInlineDistinct()) {
15864 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
15865 }
15866 else {
15867 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
15868 }
15869
15870 QueryPos qPos = QueryPos.getInstance(q);
15871
15872 qPos.add(groupId);
15873
15874 if (urlTitle != null) {
15875 qPos.add(urlTitle);
15876 }
15877
15878 qPos.add(status);
15879
15880 return (List<JournalArticle>)QueryUtil.list(q, getDialect(), start,
15881 end);
15882 }
15883 catch (Exception e) {
15884 throw processException(e);
15885 }
15886 finally {
15887 closeSession(session);
15888 }
15889 }
15890
15891
15903 public JournalArticle[] filterFindByG_UT_ST_PrevAndNext(long id,
15904 long groupId, String urlTitle, int status,
15905 OrderByComparator orderByComparator)
15906 throws NoSuchArticleException, SystemException {
15907 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
15908 return findByG_UT_ST_PrevAndNext(id, groupId, urlTitle, status,
15909 orderByComparator);
15910 }
15911
15912 JournalArticle journalArticle = findByPrimaryKey(id);
15913
15914 Session session = null;
15915
15916 try {
15917 session = openSession();
15918
15919 JournalArticle[] array = new JournalArticleImpl[3];
15920
15921 array[0] = filterGetByG_UT_ST_PrevAndNext(session, journalArticle,
15922 groupId, urlTitle, status, orderByComparator, true);
15923
15924 array[1] = journalArticle;
15925
15926 array[2] = filterGetByG_UT_ST_PrevAndNext(session, journalArticle,
15927 groupId, urlTitle, status, orderByComparator, false);
15928
15929 return array;
15930 }
15931 catch (Exception e) {
15932 throw processException(e);
15933 }
15934 finally {
15935 closeSession(session);
15936 }
15937 }
15938
15939 protected JournalArticle filterGetByG_UT_ST_PrevAndNext(Session session,
15940 JournalArticle journalArticle, long groupId, String urlTitle,
15941 int status, OrderByComparator orderByComparator, boolean previous) {
15942 StringBundler query = null;
15943
15944 if (orderByComparator != null) {
15945 query = new StringBundler(6 +
15946 (orderByComparator.getOrderByFields().length * 6));
15947 }
15948 else {
15949 query = new StringBundler(3);
15950 }
15951
15952 if (getDB().isSupportsInlineDistinct()) {
15953 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_WHERE);
15954 }
15955 else {
15956 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1);
15957 }
15958
15959 query.append(_FINDER_COLUMN_G_UT_ST_GROUPID_2);
15960
15961 if (urlTitle == null) {
15962 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_1);
15963 }
15964 else {
15965 if (urlTitle.equals(StringPool.BLANK)) {
15966 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_3);
15967 }
15968 else {
15969 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_2);
15970 }
15971 }
15972
15973 query.append(_FINDER_COLUMN_G_UT_ST_STATUS_2);
15974
15975 if (!getDB().isSupportsInlineDistinct()) {
15976 query.append(_FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2);
15977 }
15978
15979 if (orderByComparator != null) {
15980 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
15981
15982 if (orderByConditionFields.length > 0) {
15983 query.append(WHERE_AND);
15984 }
15985
15986 for (int i = 0; i < orderByConditionFields.length; i++) {
15987 if (getDB().isSupportsInlineDistinct()) {
15988 query.append(_ORDER_BY_ENTITY_ALIAS);
15989 }
15990 else {
15991 query.append(_ORDER_BY_ENTITY_TABLE);
15992 }
15993
15994 query.append(orderByConditionFields[i]);
15995
15996 if ((i + 1) < orderByConditionFields.length) {
15997 if (orderByComparator.isAscending() ^ previous) {
15998 query.append(WHERE_GREATER_THAN_HAS_NEXT);
15999 }
16000 else {
16001 query.append(WHERE_LESSER_THAN_HAS_NEXT);
16002 }
16003 }
16004 else {
16005 if (orderByComparator.isAscending() ^ previous) {
16006 query.append(WHERE_GREATER_THAN);
16007 }
16008 else {
16009 query.append(WHERE_LESSER_THAN);
16010 }
16011 }
16012 }
16013
16014 query.append(ORDER_BY_CLAUSE);
16015
16016 String[] orderByFields = orderByComparator.getOrderByFields();
16017
16018 for (int i = 0; i < orderByFields.length; i++) {
16019 if (getDB().isSupportsInlineDistinct()) {
16020 query.append(_ORDER_BY_ENTITY_ALIAS);
16021 }
16022 else {
16023 query.append(_ORDER_BY_ENTITY_TABLE);
16024 }
16025
16026 query.append(orderByFields[i]);
16027
16028 if ((i + 1) < orderByFields.length) {
16029 if (orderByComparator.isAscending() ^ previous) {
16030 query.append(ORDER_BY_ASC_HAS_NEXT);
16031 }
16032 else {
16033 query.append(ORDER_BY_DESC_HAS_NEXT);
16034 }
16035 }
16036 else {
16037 if (orderByComparator.isAscending() ^ previous) {
16038 query.append(ORDER_BY_ASC);
16039 }
16040 else {
16041 query.append(ORDER_BY_DESC);
16042 }
16043 }
16044 }
16045 }
16046
16047 else {
16048 if (getDB().isSupportsInlineDistinct()) {
16049 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
16050 }
16051 else {
16052 query.append(JournalArticleModelImpl.ORDER_BY_SQL);
16053 }
16054 }
16055
16056 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
16057 JournalArticle.class.getName(),
16058 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
16059
16060 SQLQuery q = session.createSQLQuery(sql);
16061
16062 q.setFirstResult(0);
16063 q.setMaxResults(2);
16064
16065 if (getDB().isSupportsInlineDistinct()) {
16066 q.addEntity(_FILTER_ENTITY_ALIAS, JournalArticleImpl.class);
16067 }
16068 else {
16069 q.addEntity(_FILTER_ENTITY_TABLE, JournalArticleImpl.class);
16070 }
16071
16072 QueryPos qPos = QueryPos.getInstance(q);
16073
16074 qPos.add(groupId);
16075
16076 if (urlTitle != null) {
16077 qPos.add(urlTitle);
16078 }
16079
16080 qPos.add(status);
16081
16082 if (orderByComparator != null) {
16083 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
16084
16085 for (Object value : values) {
16086 qPos.add(value);
16087 }
16088 }
16089
16090 List<JournalArticle> list = q.list();
16091
16092 if (list.size() == 2) {
16093 return list.get(1);
16094 }
16095 else {
16096 return null;
16097 }
16098 }
16099
16100
16109 public List<JournalArticle> findByC_V_ST(long companyId, double version,
16110 int status) throws SystemException {
16111 return findByC_V_ST(companyId, version, status, QueryUtil.ALL_POS,
16112 QueryUtil.ALL_POS, null);
16113 }
16114
16115
16130 public List<JournalArticle> findByC_V_ST(long companyId, double version,
16131 int status, int start, int end) throws SystemException {
16132 return findByC_V_ST(companyId, version, status, start, end, null);
16133 }
16134
16135
16151 public List<JournalArticle> findByC_V_ST(long companyId, double version,
16152 int status, int start, int end, OrderByComparator orderByComparator)
16153 throws SystemException {
16154 FinderPath finderPath = null;
16155 Object[] finderArgs = null;
16156
16157 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
16158 (orderByComparator == null)) {
16159 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_V_ST;
16160 finderArgs = new Object[] { companyId, version, status };
16161 }
16162 else {
16163 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_V_ST;
16164 finderArgs = new Object[] {
16165 companyId, version, status,
16166
16167 start, end, orderByComparator
16168 };
16169 }
16170
16171 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
16172 finderArgs, this);
16173
16174 if ((list != null) && !list.isEmpty()) {
16175 for (JournalArticle journalArticle : list) {
16176 if ((companyId != journalArticle.getCompanyId()) ||
16177 (version != journalArticle.getVersion()) ||
16178 (status != journalArticle.getStatus())) {
16179 list = null;
16180
16181 break;
16182 }
16183 }
16184 }
16185
16186 if (list == null) {
16187 StringBundler query = null;
16188
16189 if (orderByComparator != null) {
16190 query = new StringBundler(5 +
16191 (orderByComparator.getOrderByFields().length * 3));
16192 }
16193 else {
16194 query = new StringBundler(5);
16195 }
16196
16197 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
16198
16199 query.append(_FINDER_COLUMN_C_V_ST_COMPANYID_2);
16200
16201 query.append(_FINDER_COLUMN_C_V_ST_VERSION_2);
16202
16203 query.append(_FINDER_COLUMN_C_V_ST_STATUS_2);
16204
16205 if (orderByComparator != null) {
16206 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
16207 orderByComparator);
16208 }
16209
16210 else {
16211 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
16212 }
16213
16214 String sql = query.toString();
16215
16216 Session session = null;
16217
16218 try {
16219 session = openSession();
16220
16221 Query q = session.createQuery(sql);
16222
16223 QueryPos qPos = QueryPos.getInstance(q);
16224
16225 qPos.add(companyId);
16226
16227 qPos.add(version);
16228
16229 qPos.add(status);
16230
16231 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
16232 start, end);
16233 }
16234 catch (Exception e) {
16235 throw processException(e);
16236 }
16237 finally {
16238 if (list == null) {
16239 FinderCacheUtil.removeResult(finderPath, finderArgs);
16240 }
16241 else {
16242 cacheResult(list);
16243
16244 FinderCacheUtil.putResult(finderPath, finderArgs, list);
16245 }
16246
16247 closeSession(session);
16248 }
16249 }
16250
16251 return list;
16252 }
16253
16254
16265 public JournalArticle findByC_V_ST_First(long companyId, double version,
16266 int status, OrderByComparator orderByComparator)
16267 throws NoSuchArticleException, SystemException {
16268 JournalArticle journalArticle = fetchByC_V_ST_First(companyId, version,
16269 status, orderByComparator);
16270
16271 if (journalArticle != null) {
16272 return journalArticle;
16273 }
16274
16275 StringBundler msg = new StringBundler(8);
16276
16277 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
16278
16279 msg.append("companyId=");
16280 msg.append(companyId);
16281
16282 msg.append(", version=");
16283 msg.append(version);
16284
16285 msg.append(", status=");
16286 msg.append(status);
16287
16288 msg.append(StringPool.CLOSE_CURLY_BRACE);
16289
16290 throw new NoSuchArticleException(msg.toString());
16291 }
16292
16293
16303 public JournalArticle fetchByC_V_ST_First(long companyId, double version,
16304 int status, OrderByComparator orderByComparator)
16305 throws SystemException {
16306 List<JournalArticle> list = findByC_V_ST(companyId, version, status, 0,
16307 1, orderByComparator);
16308
16309 if (!list.isEmpty()) {
16310 return list.get(0);
16311 }
16312
16313 return null;
16314 }
16315
16316
16327 public JournalArticle findByC_V_ST_Last(long companyId, double version,
16328 int status, OrderByComparator orderByComparator)
16329 throws NoSuchArticleException, SystemException {
16330 JournalArticle journalArticle = fetchByC_V_ST_Last(companyId, version,
16331 status, orderByComparator);
16332
16333 if (journalArticle != null) {
16334 return journalArticle;
16335 }
16336
16337 StringBundler msg = new StringBundler(8);
16338
16339 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
16340
16341 msg.append("companyId=");
16342 msg.append(companyId);
16343
16344 msg.append(", version=");
16345 msg.append(version);
16346
16347 msg.append(", status=");
16348 msg.append(status);
16349
16350 msg.append(StringPool.CLOSE_CURLY_BRACE);
16351
16352 throw new NoSuchArticleException(msg.toString());
16353 }
16354
16355
16365 public JournalArticle fetchByC_V_ST_Last(long companyId, double version,
16366 int status, OrderByComparator orderByComparator)
16367 throws SystemException {
16368 int count = countByC_V_ST(companyId, version, status);
16369
16370 List<JournalArticle> list = findByC_V_ST(companyId, version, status,
16371 count - 1, count, orderByComparator);
16372
16373 if (!list.isEmpty()) {
16374 return list.get(0);
16375 }
16376
16377 return null;
16378 }
16379
16380
16392 public JournalArticle[] findByC_V_ST_PrevAndNext(long id, long companyId,
16393 double version, int status, OrderByComparator orderByComparator)
16394 throws NoSuchArticleException, SystemException {
16395 JournalArticle journalArticle = findByPrimaryKey(id);
16396
16397 Session session = null;
16398
16399 try {
16400 session = openSession();
16401
16402 JournalArticle[] array = new JournalArticleImpl[3];
16403
16404 array[0] = getByC_V_ST_PrevAndNext(session, journalArticle,
16405 companyId, version, status, orderByComparator, true);
16406
16407 array[1] = journalArticle;
16408
16409 array[2] = getByC_V_ST_PrevAndNext(session, journalArticle,
16410 companyId, version, status, orderByComparator, false);
16411
16412 return array;
16413 }
16414 catch (Exception e) {
16415 throw processException(e);
16416 }
16417 finally {
16418 closeSession(session);
16419 }
16420 }
16421
16422 protected JournalArticle getByC_V_ST_PrevAndNext(Session session,
16423 JournalArticle journalArticle, long companyId, double version,
16424 int status, OrderByComparator orderByComparator, boolean previous) {
16425 StringBundler query = null;
16426
16427 if (orderByComparator != null) {
16428 query = new StringBundler(6 +
16429 (orderByComparator.getOrderByFields().length * 6));
16430 }
16431 else {
16432 query = new StringBundler(3);
16433 }
16434
16435 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
16436
16437 query.append(_FINDER_COLUMN_C_V_ST_COMPANYID_2);
16438
16439 query.append(_FINDER_COLUMN_C_V_ST_VERSION_2);
16440
16441 query.append(_FINDER_COLUMN_C_V_ST_STATUS_2);
16442
16443 if (orderByComparator != null) {
16444 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
16445
16446 if (orderByConditionFields.length > 0) {
16447 query.append(WHERE_AND);
16448 }
16449
16450 for (int i = 0; i < orderByConditionFields.length; i++) {
16451 query.append(_ORDER_BY_ENTITY_ALIAS);
16452 query.append(orderByConditionFields[i]);
16453
16454 if ((i + 1) < orderByConditionFields.length) {
16455 if (orderByComparator.isAscending() ^ previous) {
16456 query.append(WHERE_GREATER_THAN_HAS_NEXT);
16457 }
16458 else {
16459 query.append(WHERE_LESSER_THAN_HAS_NEXT);
16460 }
16461 }
16462 else {
16463 if (orderByComparator.isAscending() ^ previous) {
16464 query.append(WHERE_GREATER_THAN);
16465 }
16466 else {
16467 query.append(WHERE_LESSER_THAN);
16468 }
16469 }
16470 }
16471
16472 query.append(ORDER_BY_CLAUSE);
16473
16474 String[] orderByFields = orderByComparator.getOrderByFields();
16475
16476 for (int i = 0; i < orderByFields.length; i++) {
16477 query.append(_ORDER_BY_ENTITY_ALIAS);
16478 query.append(orderByFields[i]);
16479
16480 if ((i + 1) < orderByFields.length) {
16481 if (orderByComparator.isAscending() ^ previous) {
16482 query.append(ORDER_BY_ASC_HAS_NEXT);
16483 }
16484 else {
16485 query.append(ORDER_BY_DESC_HAS_NEXT);
16486 }
16487 }
16488 else {
16489 if (orderByComparator.isAscending() ^ previous) {
16490 query.append(ORDER_BY_ASC);
16491 }
16492 else {
16493 query.append(ORDER_BY_DESC);
16494 }
16495 }
16496 }
16497 }
16498
16499 else {
16500 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
16501 }
16502
16503 String sql = query.toString();
16504
16505 Query q = session.createQuery(sql);
16506
16507 q.setFirstResult(0);
16508 q.setMaxResults(2);
16509
16510 QueryPos qPos = QueryPos.getInstance(q);
16511
16512 qPos.add(companyId);
16513
16514 qPos.add(version);
16515
16516 qPos.add(status);
16517
16518 if (orderByComparator != null) {
16519 Object[] values = orderByComparator.getOrderByConditionValues(journalArticle);
16520
16521 for (Object value : values) {
16522 qPos.add(value);
16523 }
16524 }
16525
16526 List<JournalArticle> list = q.list();
16527
16528 if (list.size() == 2) {
16529 return list.get(1);
16530 }
16531 else {
16532 return null;
16533 }
16534 }
16535
16536
16542 public List<JournalArticle> findAll() throws SystemException {
16543 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
16544 }
16545
16546
16558 public List<JournalArticle> findAll(int start, int end)
16559 throws SystemException {
16560 return findAll(start, end, null);
16561 }
16562
16563
16576 public List<JournalArticle> findAll(int start, int end,
16577 OrderByComparator orderByComparator) throws SystemException {
16578 FinderPath finderPath = null;
16579 Object[] finderArgs = new Object[] { start, end, orderByComparator };
16580
16581 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
16582 (orderByComparator == null)) {
16583 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
16584 finderArgs = FINDER_ARGS_EMPTY;
16585 }
16586 else {
16587 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
16588 finderArgs = new Object[] { start, end, orderByComparator };
16589 }
16590
16591 List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(finderPath,
16592 finderArgs, this);
16593
16594 if (list == null) {
16595 StringBundler query = null;
16596 String sql = null;
16597
16598 if (orderByComparator != null) {
16599 query = new StringBundler(2 +
16600 (orderByComparator.getOrderByFields().length * 3));
16601
16602 query.append(_SQL_SELECT_JOURNALARTICLE);
16603
16604 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
16605 orderByComparator);
16606
16607 sql = query.toString();
16608 }
16609 else {
16610 sql = _SQL_SELECT_JOURNALARTICLE.concat(JournalArticleModelImpl.ORDER_BY_JPQL);
16611 }
16612
16613 Session session = null;
16614
16615 try {
16616 session = openSession();
16617
16618 Query q = session.createQuery(sql);
16619
16620 if (orderByComparator == null) {
16621 list = (List<JournalArticle>)QueryUtil.list(q,
16622 getDialect(), start, end, false);
16623
16624 Collections.sort(list);
16625 }
16626 else {
16627 list = (List<JournalArticle>)QueryUtil.list(q,
16628 getDialect(), start, end);
16629 }
16630 }
16631 catch (Exception e) {
16632 throw processException(e);
16633 }
16634 finally {
16635 if (list == null) {
16636 FinderCacheUtil.removeResult(finderPath, finderArgs);
16637 }
16638 else {
16639 cacheResult(list);
16640
16641 FinderCacheUtil.putResult(finderPath, finderArgs, list);
16642 }
16643
16644 closeSession(session);
16645 }
16646 }
16647
16648 return list;
16649 }
16650
16651
16657 public void removeByUuid(String uuid) throws SystemException {
16658 for (JournalArticle journalArticle : findByUuid(uuid)) {
16659 remove(journalArticle);
16660 }
16661 }
16662
16663
16671 public JournalArticle removeByUUID_G(String uuid, long groupId)
16672 throws NoSuchArticleException, SystemException {
16673 JournalArticle journalArticle = findByUUID_G(uuid, groupId);
16674
16675 return remove(journalArticle);
16676 }
16677
16678
16684 public void removeByResourcePrimKey(long resourcePrimKey)
16685 throws SystemException {
16686 for (JournalArticle journalArticle : findByResourcePrimKey(
16687 resourcePrimKey)) {
16688 remove(journalArticle);
16689 }
16690 }
16691
16692
16698 public void removeByGroupId(long groupId) throws SystemException {
16699 for (JournalArticle journalArticle : findByGroupId(groupId)) {
16700 remove(journalArticle);
16701 }
16702 }
16703
16704
16710 public void removeByCompanyId(long companyId) throws SystemException {
16711 for (JournalArticle journalArticle : findByCompanyId(companyId)) {
16712 remove(journalArticle);
16713 }
16714 }
16715
16716
16722 public void removeByStructureId(String structureId)
16723 throws SystemException {
16724 for (JournalArticle journalArticle : findByStructureId(structureId)) {
16725 remove(journalArticle);
16726 }
16727 }
16728
16729
16735 public void removeByTemplateId(String templateId) throws SystemException {
16736 for (JournalArticle journalArticle : findByTemplateId(templateId)) {
16737 remove(journalArticle);
16738 }
16739 }
16740
16741
16747 public void removeByLayoutUuid(String layoutUuid) throws SystemException {
16748 for (JournalArticle journalArticle : findByLayoutUuid(layoutUuid)) {
16749 remove(journalArticle);
16750 }
16751 }
16752
16753
16759 public void removeBySmallImageId(long smallImageId)
16760 throws SystemException {
16761 for (JournalArticle journalArticle : findBySmallImageId(smallImageId)) {
16762 remove(journalArticle);
16763 }
16764 }
16765
16766
16773 public void removeByR_ST(long resourcePrimKey, int status)
16774 throws SystemException {
16775 for (JournalArticle journalArticle : findByR_ST(resourcePrimKey, status)) {
16776 remove(journalArticle);
16777 }
16778 }
16779
16780
16787 public void removeByG_A(long groupId, String articleId)
16788 throws SystemException {
16789 for (JournalArticle journalArticle : findByG_A(groupId, articleId)) {
16790 remove(journalArticle);
16791 }
16792 }
16793
16794
16801 public void removeByG_UT(long groupId, String urlTitle)
16802 throws SystemException {
16803 for (JournalArticle journalArticle : findByG_UT(groupId, urlTitle)) {
16804 remove(journalArticle);
16805 }
16806 }
16807
16808
16815 public void removeByG_S(long groupId, String structureId)
16816 throws SystemException {
16817 for (JournalArticle journalArticle : findByG_S(groupId, structureId)) {
16818 remove(journalArticle);
16819 }
16820 }
16821
16822
16829 public void removeByG_T(long groupId, String templateId)
16830 throws SystemException {
16831 for (JournalArticle journalArticle : findByG_T(groupId, templateId)) {
16832 remove(journalArticle);
16833 }
16834 }
16835
16836
16843 public void removeByG_L(long groupId, String layoutUuid)
16844 throws SystemException {
16845 for (JournalArticle journalArticle : findByG_L(groupId, layoutUuid)) {
16846 remove(journalArticle);
16847 }
16848 }
16849
16850
16857 public void removeByG_ST(long groupId, int status)
16858 throws SystemException {
16859 for (JournalArticle journalArticle : findByG_ST(groupId, status)) {
16860 remove(journalArticle);
16861 }
16862 }
16863
16864
16871 public void removeByC_V(long companyId, double version)
16872 throws SystemException {
16873 for (JournalArticle journalArticle : findByC_V(companyId, version)) {
16874 remove(journalArticle);
16875 }
16876 }
16877
16878
16885 public void removeByC_ST(long companyId, int status)
16886 throws SystemException {
16887 for (JournalArticle journalArticle : findByC_ST(companyId, status)) {
16888 remove(journalArticle);
16889 }
16890 }
16891
16892
16900 public void removeByG_C_C(long groupId, long classNameId, long classPK)
16901 throws SystemException {
16902 for (JournalArticle journalArticle : findByG_C_C(groupId, classNameId,
16903 classPK)) {
16904 remove(journalArticle);
16905 }
16906 }
16907
16908
16917 public JournalArticle removeByG_C_S(long groupId, long classNameId,
16918 String structureId) throws NoSuchArticleException, SystemException {
16919 JournalArticle journalArticle = findByG_C_S(groupId, classNameId,
16920 structureId);
16921
16922 return remove(journalArticle);
16923 }
16924
16925
16933 public void removeByG_C_T(long groupId, long classNameId, String templateId)
16934 throws SystemException {
16935 for (JournalArticle journalArticle : findByG_C_T(groupId, classNameId,
16936 templateId)) {
16937 remove(journalArticle);
16938 }
16939 }
16940
16941
16949 public void removeByG_C_L(long groupId, long classNameId, String layoutUuid)
16950 throws SystemException {
16951 for (JournalArticle journalArticle : findByG_C_L(groupId, classNameId,
16952 layoutUuid)) {
16953 remove(journalArticle);
16954 }
16955 }
16956
16957
16966 public JournalArticle removeByG_A_V(long groupId, String articleId,
16967 double version) throws NoSuchArticleException, SystemException {
16968 JournalArticle journalArticle = findByG_A_V(groupId, articleId, version);
16969
16970 return remove(journalArticle);
16971 }
16972
16973
16981 public void removeByG_A_ST(long groupId, String articleId, int status)
16982 throws SystemException {
16983 for (JournalArticle journalArticle : findByG_A_ST(groupId, articleId,
16984 status)) {
16985 remove(journalArticle);
16986 }
16987 }
16988
16989
16997 public void removeByG_UT_ST(long groupId, String urlTitle, int status)
16998 throws SystemException {
16999 for (JournalArticle journalArticle : findByG_UT_ST(groupId, urlTitle,
17000 status)) {
17001 remove(journalArticle);
17002 }
17003 }
17004
17005
17013 public void removeByC_V_ST(long companyId, double version, int status)
17014 throws SystemException {
17015 for (JournalArticle journalArticle : findByC_V_ST(companyId, version,
17016 status)) {
17017 remove(journalArticle);
17018 }
17019 }
17020
17021
17026 public void removeAll() throws SystemException {
17027 for (JournalArticle journalArticle : findAll()) {
17028 remove(journalArticle);
17029 }
17030 }
17031
17032
17039 public int countByUuid(String uuid) throws SystemException {
17040 Object[] finderArgs = new Object[] { uuid };
17041
17042 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
17043 finderArgs, this);
17044
17045 if (count == null) {
17046 StringBundler query = new StringBundler(2);
17047
17048 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17049
17050 if (uuid == null) {
17051 query.append(_FINDER_COLUMN_UUID_UUID_1);
17052 }
17053 else {
17054 if (uuid.equals(StringPool.BLANK)) {
17055 query.append(_FINDER_COLUMN_UUID_UUID_3);
17056 }
17057 else {
17058 query.append(_FINDER_COLUMN_UUID_UUID_2);
17059 }
17060 }
17061
17062 String sql = query.toString();
17063
17064 Session session = null;
17065
17066 try {
17067 session = openSession();
17068
17069 Query q = session.createQuery(sql);
17070
17071 QueryPos qPos = QueryPos.getInstance(q);
17072
17073 if (uuid != null) {
17074 qPos.add(uuid);
17075 }
17076
17077 count = (Long)q.uniqueResult();
17078 }
17079 catch (Exception e) {
17080 throw processException(e);
17081 }
17082 finally {
17083 if (count == null) {
17084 count = Long.valueOf(0);
17085 }
17086
17087 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
17088 finderArgs, count);
17089
17090 closeSession(session);
17091 }
17092 }
17093
17094 return count.intValue();
17095 }
17096
17097
17105 public int countByUUID_G(String uuid, long groupId)
17106 throws SystemException {
17107 Object[] finderArgs = new Object[] { uuid, groupId };
17108
17109 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
17110 finderArgs, this);
17111
17112 if (count == null) {
17113 StringBundler query = new StringBundler(3);
17114
17115 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17116
17117 if (uuid == null) {
17118 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
17119 }
17120 else {
17121 if (uuid.equals(StringPool.BLANK)) {
17122 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
17123 }
17124 else {
17125 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
17126 }
17127 }
17128
17129 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
17130
17131 String sql = query.toString();
17132
17133 Session session = null;
17134
17135 try {
17136 session = openSession();
17137
17138 Query q = session.createQuery(sql);
17139
17140 QueryPos qPos = QueryPos.getInstance(q);
17141
17142 if (uuid != null) {
17143 qPos.add(uuid);
17144 }
17145
17146 qPos.add(groupId);
17147
17148 count = (Long)q.uniqueResult();
17149 }
17150 catch (Exception e) {
17151 throw processException(e);
17152 }
17153 finally {
17154 if (count == null) {
17155 count = Long.valueOf(0);
17156 }
17157
17158 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
17159 finderArgs, count);
17160
17161 closeSession(session);
17162 }
17163 }
17164
17165 return count.intValue();
17166 }
17167
17168
17175 public int countByResourcePrimKey(long resourcePrimKey)
17176 throws SystemException {
17177 Object[] finderArgs = new Object[] { resourcePrimKey };
17178
17179 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RESOURCEPRIMKEY,
17180 finderArgs, this);
17181
17182 if (count == null) {
17183 StringBundler query = new StringBundler(2);
17184
17185 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17186
17187 query.append(_FINDER_COLUMN_RESOURCEPRIMKEY_RESOURCEPRIMKEY_2);
17188
17189 String sql = query.toString();
17190
17191 Session session = null;
17192
17193 try {
17194 session = openSession();
17195
17196 Query q = session.createQuery(sql);
17197
17198 QueryPos qPos = QueryPos.getInstance(q);
17199
17200 qPos.add(resourcePrimKey);
17201
17202 count = (Long)q.uniqueResult();
17203 }
17204 catch (Exception e) {
17205 throw processException(e);
17206 }
17207 finally {
17208 if (count == null) {
17209 count = Long.valueOf(0);
17210 }
17211
17212 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RESOURCEPRIMKEY,
17213 finderArgs, count);
17214
17215 closeSession(session);
17216 }
17217 }
17218
17219 return count.intValue();
17220 }
17221
17222
17229 public int countByGroupId(long groupId) throws SystemException {
17230 Object[] finderArgs = new Object[] { groupId };
17231
17232 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
17233 finderArgs, this);
17234
17235 if (count == null) {
17236 StringBundler query = new StringBundler(2);
17237
17238 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17239
17240 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
17241
17242 String sql = query.toString();
17243
17244 Session session = null;
17245
17246 try {
17247 session = openSession();
17248
17249 Query q = session.createQuery(sql);
17250
17251 QueryPos qPos = QueryPos.getInstance(q);
17252
17253 qPos.add(groupId);
17254
17255 count = (Long)q.uniqueResult();
17256 }
17257 catch (Exception e) {
17258 throw processException(e);
17259 }
17260 finally {
17261 if (count == null) {
17262 count = Long.valueOf(0);
17263 }
17264
17265 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
17266 finderArgs, count);
17267
17268 closeSession(session);
17269 }
17270 }
17271
17272 return count.intValue();
17273 }
17274
17275
17282 public int filterCountByGroupId(long groupId) throws SystemException {
17283 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
17284 return countByGroupId(groupId);
17285 }
17286
17287 StringBundler query = new StringBundler(2);
17288
17289 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
17290
17291 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
17292
17293 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
17294 JournalArticle.class.getName(),
17295 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
17296
17297 Session session = null;
17298
17299 try {
17300 session = openSession();
17301
17302 SQLQuery q = session.createSQLQuery(sql);
17303
17304 q.addScalar(COUNT_COLUMN_NAME,
17305 com.liferay.portal.kernel.dao.orm.Type.LONG);
17306
17307 QueryPos qPos = QueryPos.getInstance(q);
17308
17309 qPos.add(groupId);
17310
17311 Long count = (Long)q.uniqueResult();
17312
17313 return count.intValue();
17314 }
17315 catch (Exception e) {
17316 throw processException(e);
17317 }
17318 finally {
17319 closeSession(session);
17320 }
17321 }
17322
17323
17330 public int countByCompanyId(long companyId) throws SystemException {
17331 Object[] finderArgs = new Object[] { companyId };
17332
17333 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
17334 finderArgs, this);
17335
17336 if (count == null) {
17337 StringBundler query = new StringBundler(2);
17338
17339 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17340
17341 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
17342
17343 String sql = query.toString();
17344
17345 Session session = null;
17346
17347 try {
17348 session = openSession();
17349
17350 Query q = session.createQuery(sql);
17351
17352 QueryPos qPos = QueryPos.getInstance(q);
17353
17354 qPos.add(companyId);
17355
17356 count = (Long)q.uniqueResult();
17357 }
17358 catch (Exception e) {
17359 throw processException(e);
17360 }
17361 finally {
17362 if (count == null) {
17363 count = Long.valueOf(0);
17364 }
17365
17366 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
17367 finderArgs, count);
17368
17369 closeSession(session);
17370 }
17371 }
17372
17373 return count.intValue();
17374 }
17375
17376
17383 public int countByStructureId(String structureId) throws SystemException {
17384 Object[] finderArgs = new Object[] { structureId };
17385
17386 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
17387 finderArgs, this);
17388
17389 if (count == null) {
17390 StringBundler query = new StringBundler(2);
17391
17392 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17393
17394 if (structureId == null) {
17395 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1);
17396 }
17397 else {
17398 if (structureId.equals(StringPool.BLANK)) {
17399 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3);
17400 }
17401 else {
17402 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
17403 }
17404 }
17405
17406 String sql = query.toString();
17407
17408 Session session = null;
17409
17410 try {
17411 session = openSession();
17412
17413 Query q = session.createQuery(sql);
17414
17415 QueryPos qPos = QueryPos.getInstance(q);
17416
17417 if (structureId != null) {
17418 qPos.add(structureId);
17419 }
17420
17421 count = (Long)q.uniqueResult();
17422 }
17423 catch (Exception e) {
17424 throw processException(e);
17425 }
17426 finally {
17427 if (count == null) {
17428 count = Long.valueOf(0);
17429 }
17430
17431 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
17432 finderArgs, count);
17433
17434 closeSession(session);
17435 }
17436 }
17437
17438 return count.intValue();
17439 }
17440
17441
17448 public int countByTemplateId(String templateId) throws SystemException {
17449 Object[] finderArgs = new Object[] { templateId };
17450
17451 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
17452 finderArgs, this);
17453
17454 if (count == null) {
17455 StringBundler query = new StringBundler(2);
17456
17457 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17458
17459 if (templateId == null) {
17460 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
17461 }
17462 else {
17463 if (templateId.equals(StringPool.BLANK)) {
17464 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
17465 }
17466 else {
17467 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
17468 }
17469 }
17470
17471 String sql = query.toString();
17472
17473 Session session = null;
17474
17475 try {
17476 session = openSession();
17477
17478 Query q = session.createQuery(sql);
17479
17480 QueryPos qPos = QueryPos.getInstance(q);
17481
17482 if (templateId != null) {
17483 qPos.add(templateId);
17484 }
17485
17486 count = (Long)q.uniqueResult();
17487 }
17488 catch (Exception e) {
17489 throw processException(e);
17490 }
17491 finally {
17492 if (count == null) {
17493 count = Long.valueOf(0);
17494 }
17495
17496 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
17497 finderArgs, count);
17498
17499 closeSession(session);
17500 }
17501 }
17502
17503 return count.intValue();
17504 }
17505
17506
17513 public int countByLayoutUuid(String layoutUuid) throws SystemException {
17514 Object[] finderArgs = new Object[] { layoutUuid };
17515
17516 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LAYOUTUUID,
17517 finderArgs, this);
17518
17519 if (count == null) {
17520 StringBundler query = new StringBundler(2);
17521
17522 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17523
17524 if (layoutUuid == null) {
17525 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_1);
17526 }
17527 else {
17528 if (layoutUuid.equals(StringPool.BLANK)) {
17529 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_3);
17530 }
17531 else {
17532 query.append(_FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_2);
17533 }
17534 }
17535
17536 String sql = query.toString();
17537
17538 Session session = null;
17539
17540 try {
17541 session = openSession();
17542
17543 Query q = session.createQuery(sql);
17544
17545 QueryPos qPos = QueryPos.getInstance(q);
17546
17547 if (layoutUuid != null) {
17548 qPos.add(layoutUuid);
17549 }
17550
17551 count = (Long)q.uniqueResult();
17552 }
17553 catch (Exception e) {
17554 throw processException(e);
17555 }
17556 finally {
17557 if (count == null) {
17558 count = Long.valueOf(0);
17559 }
17560
17561 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LAYOUTUUID,
17562 finderArgs, count);
17563
17564 closeSession(session);
17565 }
17566 }
17567
17568 return count.intValue();
17569 }
17570
17571
17578 public int countBySmallImageId(long smallImageId) throws SystemException {
17579 Object[] finderArgs = new Object[] { smallImageId };
17580
17581 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
17582 finderArgs, this);
17583
17584 if (count == null) {
17585 StringBundler query = new StringBundler(2);
17586
17587 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17588
17589 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
17590
17591 String sql = query.toString();
17592
17593 Session session = null;
17594
17595 try {
17596 session = openSession();
17597
17598 Query q = session.createQuery(sql);
17599
17600 QueryPos qPos = QueryPos.getInstance(q);
17601
17602 qPos.add(smallImageId);
17603
17604 count = (Long)q.uniqueResult();
17605 }
17606 catch (Exception e) {
17607 throw processException(e);
17608 }
17609 finally {
17610 if (count == null) {
17611 count = Long.valueOf(0);
17612 }
17613
17614 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
17615 finderArgs, count);
17616
17617 closeSession(session);
17618 }
17619 }
17620
17621 return count.intValue();
17622 }
17623
17624
17632 public int countByR_ST(long resourcePrimKey, int status)
17633 throws SystemException {
17634 Object[] finderArgs = new Object[] { resourcePrimKey, status };
17635
17636 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_R_ST,
17637 finderArgs, this);
17638
17639 if (count == null) {
17640 StringBundler query = new StringBundler(3);
17641
17642 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17643
17644 query.append(_FINDER_COLUMN_R_ST_RESOURCEPRIMKEY_2);
17645
17646 query.append(_FINDER_COLUMN_R_ST_STATUS_2);
17647
17648 String sql = query.toString();
17649
17650 Session session = null;
17651
17652 try {
17653 session = openSession();
17654
17655 Query q = session.createQuery(sql);
17656
17657 QueryPos qPos = QueryPos.getInstance(q);
17658
17659 qPos.add(resourcePrimKey);
17660
17661 qPos.add(status);
17662
17663 count = (Long)q.uniqueResult();
17664 }
17665 catch (Exception e) {
17666 throw processException(e);
17667 }
17668 finally {
17669 if (count == null) {
17670 count = Long.valueOf(0);
17671 }
17672
17673 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_R_ST,
17674 finderArgs, count);
17675
17676 closeSession(session);
17677 }
17678 }
17679
17680 return count.intValue();
17681 }
17682
17683
17691 public int countByG_A(long groupId, String articleId)
17692 throws SystemException {
17693 Object[] finderArgs = new Object[] { groupId, articleId };
17694
17695 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A,
17696 finderArgs, this);
17697
17698 if (count == null) {
17699 StringBundler query = new StringBundler(3);
17700
17701 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17702
17703 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
17704
17705 if (articleId == null) {
17706 query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
17707 }
17708 else {
17709 if (articleId.equals(StringPool.BLANK)) {
17710 query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
17711 }
17712 else {
17713 query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
17714 }
17715 }
17716
17717 String sql = query.toString();
17718
17719 Session session = null;
17720
17721 try {
17722 session = openSession();
17723
17724 Query q = session.createQuery(sql);
17725
17726 QueryPos qPos = QueryPos.getInstance(q);
17727
17728 qPos.add(groupId);
17729
17730 if (articleId != null) {
17731 qPos.add(articleId);
17732 }
17733
17734 count = (Long)q.uniqueResult();
17735 }
17736 catch (Exception e) {
17737 throw processException(e);
17738 }
17739 finally {
17740 if (count == null) {
17741 count = Long.valueOf(0);
17742 }
17743
17744 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A, finderArgs,
17745 count);
17746
17747 closeSession(session);
17748 }
17749 }
17750
17751 return count.intValue();
17752 }
17753
17754
17762 public int filterCountByG_A(long groupId, String articleId)
17763 throws SystemException {
17764 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
17765 return countByG_A(groupId, articleId);
17766 }
17767
17768 StringBundler query = new StringBundler(3);
17769
17770 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
17771
17772 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
17773
17774 if (articleId == null) {
17775 query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
17776 }
17777 else {
17778 if (articleId.equals(StringPool.BLANK)) {
17779 query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
17780 }
17781 else {
17782 query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
17783 }
17784 }
17785
17786 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
17787 JournalArticle.class.getName(),
17788 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
17789
17790 Session session = null;
17791
17792 try {
17793 session = openSession();
17794
17795 SQLQuery q = session.createSQLQuery(sql);
17796
17797 q.addScalar(COUNT_COLUMN_NAME,
17798 com.liferay.portal.kernel.dao.orm.Type.LONG);
17799
17800 QueryPos qPos = QueryPos.getInstance(q);
17801
17802 qPos.add(groupId);
17803
17804 if (articleId != null) {
17805 qPos.add(articleId);
17806 }
17807
17808 Long count = (Long)q.uniqueResult();
17809
17810 return count.intValue();
17811 }
17812 catch (Exception e) {
17813 throw processException(e);
17814 }
17815 finally {
17816 closeSession(session);
17817 }
17818 }
17819
17820
17828 public int countByG_UT(long groupId, String urlTitle)
17829 throws SystemException {
17830 Object[] finderArgs = new Object[] { groupId, urlTitle };
17831
17832 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT,
17833 finderArgs, this);
17834
17835 if (count == null) {
17836 StringBundler query = new StringBundler(3);
17837
17838 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17839
17840 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
17841
17842 if (urlTitle == null) {
17843 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
17844 }
17845 else {
17846 if (urlTitle.equals(StringPool.BLANK)) {
17847 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
17848 }
17849 else {
17850 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
17851 }
17852 }
17853
17854 String sql = query.toString();
17855
17856 Session session = null;
17857
17858 try {
17859 session = openSession();
17860
17861 Query q = session.createQuery(sql);
17862
17863 QueryPos qPos = QueryPos.getInstance(q);
17864
17865 qPos.add(groupId);
17866
17867 if (urlTitle != null) {
17868 qPos.add(urlTitle);
17869 }
17870
17871 count = (Long)q.uniqueResult();
17872 }
17873 catch (Exception e) {
17874 throw processException(e);
17875 }
17876 finally {
17877 if (count == null) {
17878 count = Long.valueOf(0);
17879 }
17880
17881 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT,
17882 finderArgs, count);
17883
17884 closeSession(session);
17885 }
17886 }
17887
17888 return count.intValue();
17889 }
17890
17891
17899 public int filterCountByG_UT(long groupId, String urlTitle)
17900 throws SystemException {
17901 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
17902 return countByG_UT(groupId, urlTitle);
17903 }
17904
17905 StringBundler query = new StringBundler(3);
17906
17907 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
17908
17909 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
17910
17911 if (urlTitle == null) {
17912 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
17913 }
17914 else {
17915 if (urlTitle.equals(StringPool.BLANK)) {
17916 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
17917 }
17918 else {
17919 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
17920 }
17921 }
17922
17923 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
17924 JournalArticle.class.getName(),
17925 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
17926
17927 Session session = null;
17928
17929 try {
17930 session = openSession();
17931
17932 SQLQuery q = session.createSQLQuery(sql);
17933
17934 q.addScalar(COUNT_COLUMN_NAME,
17935 com.liferay.portal.kernel.dao.orm.Type.LONG);
17936
17937 QueryPos qPos = QueryPos.getInstance(q);
17938
17939 qPos.add(groupId);
17940
17941 if (urlTitle != null) {
17942 qPos.add(urlTitle);
17943 }
17944
17945 Long count = (Long)q.uniqueResult();
17946
17947 return count.intValue();
17948 }
17949 catch (Exception e) {
17950 throw processException(e);
17951 }
17952 finally {
17953 closeSession(session);
17954 }
17955 }
17956
17957
17965 public int countByG_S(long groupId, String structureId)
17966 throws SystemException {
17967 Object[] finderArgs = new Object[] { groupId, structureId };
17968
17969 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
17970 finderArgs, this);
17971
17972 if (count == null) {
17973 StringBundler query = new StringBundler(3);
17974
17975 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
17976
17977 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
17978
17979 if (structureId == null) {
17980 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
17981 }
17982 else {
17983 if (structureId.equals(StringPool.BLANK)) {
17984 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
17985 }
17986 else {
17987 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
17988 }
17989 }
17990
17991 String sql = query.toString();
17992
17993 Session session = null;
17994
17995 try {
17996 session = openSession();
17997
17998 Query q = session.createQuery(sql);
17999
18000 QueryPos qPos = QueryPos.getInstance(q);
18001
18002 qPos.add(groupId);
18003
18004 if (structureId != null) {
18005 qPos.add(structureId);
18006 }
18007
18008 count = (Long)q.uniqueResult();
18009 }
18010 catch (Exception e) {
18011 throw processException(e);
18012 }
18013 finally {
18014 if (count == null) {
18015 count = Long.valueOf(0);
18016 }
18017
18018 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
18019 count);
18020
18021 closeSession(session);
18022 }
18023 }
18024
18025 return count.intValue();
18026 }
18027
18028
18036 public int filterCountByG_S(long groupId, String structureId)
18037 throws SystemException {
18038 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
18039 return countByG_S(groupId, structureId);
18040 }
18041
18042 StringBundler query = new StringBundler(3);
18043
18044 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
18045
18046 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
18047
18048 if (structureId == null) {
18049 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
18050 }
18051 else {
18052 if (structureId.equals(StringPool.BLANK)) {
18053 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
18054 }
18055 else {
18056 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
18057 }
18058 }
18059
18060 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
18061 JournalArticle.class.getName(),
18062 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
18063
18064 Session session = null;
18065
18066 try {
18067 session = openSession();
18068
18069 SQLQuery q = session.createSQLQuery(sql);
18070
18071 q.addScalar(COUNT_COLUMN_NAME,
18072 com.liferay.portal.kernel.dao.orm.Type.LONG);
18073
18074 QueryPos qPos = QueryPos.getInstance(q);
18075
18076 qPos.add(groupId);
18077
18078 if (structureId != null) {
18079 qPos.add(structureId);
18080 }
18081
18082 Long count = (Long)q.uniqueResult();
18083
18084 return count.intValue();
18085 }
18086 catch (Exception e) {
18087 throw processException(e);
18088 }
18089 finally {
18090 closeSession(session);
18091 }
18092 }
18093
18094
18102 public int countByG_T(long groupId, String templateId)
18103 throws SystemException {
18104 Object[] finderArgs = new Object[] { groupId, templateId };
18105
18106 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_T,
18107 finderArgs, this);
18108
18109 if (count == null) {
18110 StringBundler query = new StringBundler(3);
18111
18112 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18113
18114 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
18115
18116 if (templateId == null) {
18117 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
18118 }
18119 else {
18120 if (templateId.equals(StringPool.BLANK)) {
18121 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
18122 }
18123 else {
18124 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
18125 }
18126 }
18127
18128 String sql = query.toString();
18129
18130 Session session = null;
18131
18132 try {
18133 session = openSession();
18134
18135 Query q = session.createQuery(sql);
18136
18137 QueryPos qPos = QueryPos.getInstance(q);
18138
18139 qPos.add(groupId);
18140
18141 if (templateId != null) {
18142 qPos.add(templateId);
18143 }
18144
18145 count = (Long)q.uniqueResult();
18146 }
18147 catch (Exception e) {
18148 throw processException(e);
18149 }
18150 finally {
18151 if (count == null) {
18152 count = Long.valueOf(0);
18153 }
18154
18155 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_T, finderArgs,
18156 count);
18157
18158 closeSession(session);
18159 }
18160 }
18161
18162 return count.intValue();
18163 }
18164
18165
18173 public int filterCountByG_T(long groupId, String templateId)
18174 throws SystemException {
18175 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
18176 return countByG_T(groupId, templateId);
18177 }
18178
18179 StringBundler query = new StringBundler(3);
18180
18181 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
18182
18183 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
18184
18185 if (templateId == null) {
18186 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
18187 }
18188 else {
18189 if (templateId.equals(StringPool.BLANK)) {
18190 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
18191 }
18192 else {
18193 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
18194 }
18195 }
18196
18197 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
18198 JournalArticle.class.getName(),
18199 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
18200
18201 Session session = null;
18202
18203 try {
18204 session = openSession();
18205
18206 SQLQuery q = session.createSQLQuery(sql);
18207
18208 q.addScalar(COUNT_COLUMN_NAME,
18209 com.liferay.portal.kernel.dao.orm.Type.LONG);
18210
18211 QueryPos qPos = QueryPos.getInstance(q);
18212
18213 qPos.add(groupId);
18214
18215 if (templateId != null) {
18216 qPos.add(templateId);
18217 }
18218
18219 Long count = (Long)q.uniqueResult();
18220
18221 return count.intValue();
18222 }
18223 catch (Exception e) {
18224 throw processException(e);
18225 }
18226 finally {
18227 closeSession(session);
18228 }
18229 }
18230
18231
18239 public int countByG_L(long groupId, String layoutUuid)
18240 throws SystemException {
18241 Object[] finderArgs = new Object[] { groupId, layoutUuid };
18242
18243 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_L,
18244 finderArgs, this);
18245
18246 if (count == null) {
18247 StringBundler query = new StringBundler(3);
18248
18249 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18250
18251 query.append(_FINDER_COLUMN_G_L_GROUPID_2);
18252
18253 if (layoutUuid == null) {
18254 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_1);
18255 }
18256 else {
18257 if (layoutUuid.equals(StringPool.BLANK)) {
18258 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_3);
18259 }
18260 else {
18261 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_2);
18262 }
18263 }
18264
18265 String sql = query.toString();
18266
18267 Session session = null;
18268
18269 try {
18270 session = openSession();
18271
18272 Query q = session.createQuery(sql);
18273
18274 QueryPos qPos = QueryPos.getInstance(q);
18275
18276 qPos.add(groupId);
18277
18278 if (layoutUuid != null) {
18279 qPos.add(layoutUuid);
18280 }
18281
18282 count = (Long)q.uniqueResult();
18283 }
18284 catch (Exception e) {
18285 throw processException(e);
18286 }
18287 finally {
18288 if (count == null) {
18289 count = Long.valueOf(0);
18290 }
18291
18292 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_L, finderArgs,
18293 count);
18294
18295 closeSession(session);
18296 }
18297 }
18298
18299 return count.intValue();
18300 }
18301
18302
18310 public int filterCountByG_L(long groupId, String layoutUuid)
18311 throws SystemException {
18312 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
18313 return countByG_L(groupId, layoutUuid);
18314 }
18315
18316 StringBundler query = new StringBundler(3);
18317
18318 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
18319
18320 query.append(_FINDER_COLUMN_G_L_GROUPID_2);
18321
18322 if (layoutUuid == null) {
18323 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_1);
18324 }
18325 else {
18326 if (layoutUuid.equals(StringPool.BLANK)) {
18327 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_3);
18328 }
18329 else {
18330 query.append(_FINDER_COLUMN_G_L_LAYOUTUUID_2);
18331 }
18332 }
18333
18334 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
18335 JournalArticle.class.getName(),
18336 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
18337
18338 Session session = null;
18339
18340 try {
18341 session = openSession();
18342
18343 SQLQuery q = session.createSQLQuery(sql);
18344
18345 q.addScalar(COUNT_COLUMN_NAME,
18346 com.liferay.portal.kernel.dao.orm.Type.LONG);
18347
18348 QueryPos qPos = QueryPos.getInstance(q);
18349
18350 qPos.add(groupId);
18351
18352 if (layoutUuid != null) {
18353 qPos.add(layoutUuid);
18354 }
18355
18356 Long count = (Long)q.uniqueResult();
18357
18358 return count.intValue();
18359 }
18360 catch (Exception e) {
18361 throw processException(e);
18362 }
18363 finally {
18364 closeSession(session);
18365 }
18366 }
18367
18368
18376 public int countByG_ST(long groupId, int status) throws SystemException {
18377 Object[] finderArgs = new Object[] { groupId, status };
18378
18379 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_ST,
18380 finderArgs, this);
18381
18382 if (count == null) {
18383 StringBundler query = new StringBundler(3);
18384
18385 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18386
18387 query.append(_FINDER_COLUMN_G_ST_GROUPID_2);
18388
18389 query.append(_FINDER_COLUMN_G_ST_STATUS_2);
18390
18391 String sql = query.toString();
18392
18393 Session session = null;
18394
18395 try {
18396 session = openSession();
18397
18398 Query q = session.createQuery(sql);
18399
18400 QueryPos qPos = QueryPos.getInstance(q);
18401
18402 qPos.add(groupId);
18403
18404 qPos.add(status);
18405
18406 count = (Long)q.uniqueResult();
18407 }
18408 catch (Exception e) {
18409 throw processException(e);
18410 }
18411 finally {
18412 if (count == null) {
18413 count = Long.valueOf(0);
18414 }
18415
18416 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_ST,
18417 finderArgs, count);
18418
18419 closeSession(session);
18420 }
18421 }
18422
18423 return count.intValue();
18424 }
18425
18426
18434 public int filterCountByG_ST(long groupId, int status)
18435 throws SystemException {
18436 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
18437 return countByG_ST(groupId, status);
18438 }
18439
18440 StringBundler query = new StringBundler(3);
18441
18442 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
18443
18444 query.append(_FINDER_COLUMN_G_ST_GROUPID_2);
18445
18446 query.append(_FINDER_COLUMN_G_ST_STATUS_2);
18447
18448 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
18449 JournalArticle.class.getName(),
18450 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
18451
18452 Session session = null;
18453
18454 try {
18455 session = openSession();
18456
18457 SQLQuery q = session.createSQLQuery(sql);
18458
18459 q.addScalar(COUNT_COLUMN_NAME,
18460 com.liferay.portal.kernel.dao.orm.Type.LONG);
18461
18462 QueryPos qPos = QueryPos.getInstance(q);
18463
18464 qPos.add(groupId);
18465
18466 qPos.add(status);
18467
18468 Long count = (Long)q.uniqueResult();
18469
18470 return count.intValue();
18471 }
18472 catch (Exception e) {
18473 throw processException(e);
18474 }
18475 finally {
18476 closeSession(session);
18477 }
18478 }
18479
18480
18488 public int countByC_V(long companyId, double version)
18489 throws SystemException {
18490 Object[] finderArgs = new Object[] { companyId, version };
18491
18492 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_V,
18493 finderArgs, this);
18494
18495 if (count == null) {
18496 StringBundler query = new StringBundler(3);
18497
18498 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18499
18500 query.append(_FINDER_COLUMN_C_V_COMPANYID_2);
18501
18502 query.append(_FINDER_COLUMN_C_V_VERSION_2);
18503
18504 String sql = query.toString();
18505
18506 Session session = null;
18507
18508 try {
18509 session = openSession();
18510
18511 Query q = session.createQuery(sql);
18512
18513 QueryPos qPos = QueryPos.getInstance(q);
18514
18515 qPos.add(companyId);
18516
18517 qPos.add(version);
18518
18519 count = (Long)q.uniqueResult();
18520 }
18521 catch (Exception e) {
18522 throw processException(e);
18523 }
18524 finally {
18525 if (count == null) {
18526 count = Long.valueOf(0);
18527 }
18528
18529 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_V, finderArgs,
18530 count);
18531
18532 closeSession(session);
18533 }
18534 }
18535
18536 return count.intValue();
18537 }
18538
18539
18547 public int countByC_ST(long companyId, int status)
18548 throws SystemException {
18549 Object[] finderArgs = new Object[] { companyId, status };
18550
18551 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_ST,
18552 finderArgs, this);
18553
18554 if (count == null) {
18555 StringBundler query = new StringBundler(3);
18556
18557 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18558
18559 query.append(_FINDER_COLUMN_C_ST_COMPANYID_2);
18560
18561 query.append(_FINDER_COLUMN_C_ST_STATUS_2);
18562
18563 String sql = query.toString();
18564
18565 Session session = null;
18566
18567 try {
18568 session = openSession();
18569
18570 Query q = session.createQuery(sql);
18571
18572 QueryPos qPos = QueryPos.getInstance(q);
18573
18574 qPos.add(companyId);
18575
18576 qPos.add(status);
18577
18578 count = (Long)q.uniqueResult();
18579 }
18580 catch (Exception e) {
18581 throw processException(e);
18582 }
18583 finally {
18584 if (count == null) {
18585 count = Long.valueOf(0);
18586 }
18587
18588 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_ST,
18589 finderArgs, count);
18590
18591 closeSession(session);
18592 }
18593 }
18594
18595 return count.intValue();
18596 }
18597
18598
18607 public int countByG_C_C(long groupId, long classNameId, long classPK)
18608 throws SystemException {
18609 Object[] finderArgs = new Object[] { groupId, classNameId, classPK };
18610
18611 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_C,
18612 finderArgs, this);
18613
18614 if (count == null) {
18615 StringBundler query = new StringBundler(4);
18616
18617 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18618
18619 query.append(_FINDER_COLUMN_G_C_C_GROUPID_2);
18620
18621 query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2);
18622
18623 query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2);
18624
18625 String sql = query.toString();
18626
18627 Session session = null;
18628
18629 try {
18630 session = openSession();
18631
18632 Query q = session.createQuery(sql);
18633
18634 QueryPos qPos = QueryPos.getInstance(q);
18635
18636 qPos.add(groupId);
18637
18638 qPos.add(classNameId);
18639
18640 qPos.add(classPK);
18641
18642 count = (Long)q.uniqueResult();
18643 }
18644 catch (Exception e) {
18645 throw processException(e);
18646 }
18647 finally {
18648 if (count == null) {
18649 count = Long.valueOf(0);
18650 }
18651
18652 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_C,
18653 finderArgs, count);
18654
18655 closeSession(session);
18656 }
18657 }
18658
18659 return count.intValue();
18660 }
18661
18662
18671 public int filterCountByG_C_C(long groupId, long classNameId, long classPK)
18672 throws SystemException {
18673 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
18674 return countByG_C_C(groupId, classNameId, classPK);
18675 }
18676
18677 StringBundler query = new StringBundler(4);
18678
18679 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
18680
18681 query.append(_FINDER_COLUMN_G_C_C_GROUPID_2);
18682
18683 query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2);
18684
18685 query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2);
18686
18687 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
18688 JournalArticle.class.getName(),
18689 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
18690
18691 Session session = null;
18692
18693 try {
18694 session = openSession();
18695
18696 SQLQuery q = session.createSQLQuery(sql);
18697
18698 q.addScalar(COUNT_COLUMN_NAME,
18699 com.liferay.portal.kernel.dao.orm.Type.LONG);
18700
18701 QueryPos qPos = QueryPos.getInstance(q);
18702
18703 qPos.add(groupId);
18704
18705 qPos.add(classNameId);
18706
18707 qPos.add(classPK);
18708
18709 Long count = (Long)q.uniqueResult();
18710
18711 return count.intValue();
18712 }
18713 catch (Exception e) {
18714 throw processException(e);
18715 }
18716 finally {
18717 closeSession(session);
18718 }
18719 }
18720
18721
18730 public int countByG_C_S(long groupId, long classNameId, String structureId)
18731 throws SystemException {
18732 Object[] finderArgs = new Object[] { groupId, classNameId, structureId };
18733
18734 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_S,
18735 finderArgs, this);
18736
18737 if (count == null) {
18738 StringBundler query = new StringBundler(4);
18739
18740 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18741
18742 query.append(_FINDER_COLUMN_G_C_S_GROUPID_2);
18743
18744 query.append(_FINDER_COLUMN_G_C_S_CLASSNAMEID_2);
18745
18746 if (structureId == null) {
18747 query.append(_FINDER_COLUMN_G_C_S_STRUCTUREID_1);
18748 }
18749 else {
18750 if (structureId.equals(StringPool.BLANK)) {
18751 query.append(_FINDER_COLUMN_G_C_S_STRUCTUREID_3);
18752 }
18753 else {
18754 query.append(_FINDER_COLUMN_G_C_S_STRUCTUREID_2);
18755 }
18756 }
18757
18758 String sql = query.toString();
18759
18760 Session session = null;
18761
18762 try {
18763 session = openSession();
18764
18765 Query q = session.createQuery(sql);
18766
18767 QueryPos qPos = QueryPos.getInstance(q);
18768
18769 qPos.add(groupId);
18770
18771 qPos.add(classNameId);
18772
18773 if (structureId != null) {
18774 qPos.add(structureId);
18775 }
18776
18777 count = (Long)q.uniqueResult();
18778 }
18779 catch (Exception e) {
18780 throw processException(e);
18781 }
18782 finally {
18783 if (count == null) {
18784 count = Long.valueOf(0);
18785 }
18786
18787 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_S,
18788 finderArgs, count);
18789
18790 closeSession(session);
18791 }
18792 }
18793
18794 return count.intValue();
18795 }
18796
18797
18806 public int countByG_C_T(long groupId, long classNameId, String templateId)
18807 throws SystemException {
18808 Object[] finderArgs = new Object[] { groupId, classNameId, templateId };
18809
18810 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_T,
18811 finderArgs, this);
18812
18813 if (count == null) {
18814 StringBundler query = new StringBundler(4);
18815
18816 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18817
18818 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
18819
18820 query.append(_FINDER_COLUMN_G_C_T_CLASSNAMEID_2);
18821
18822 if (templateId == null) {
18823 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_1);
18824 }
18825 else {
18826 if (templateId.equals(StringPool.BLANK)) {
18827 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_3);
18828 }
18829 else {
18830 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_2);
18831 }
18832 }
18833
18834 String sql = query.toString();
18835
18836 Session session = null;
18837
18838 try {
18839 session = openSession();
18840
18841 Query q = session.createQuery(sql);
18842
18843 QueryPos qPos = QueryPos.getInstance(q);
18844
18845 qPos.add(groupId);
18846
18847 qPos.add(classNameId);
18848
18849 if (templateId != null) {
18850 qPos.add(templateId);
18851 }
18852
18853 count = (Long)q.uniqueResult();
18854 }
18855 catch (Exception e) {
18856 throw processException(e);
18857 }
18858 finally {
18859 if (count == null) {
18860 count = Long.valueOf(0);
18861 }
18862
18863 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_T,
18864 finderArgs, count);
18865
18866 closeSession(session);
18867 }
18868 }
18869
18870 return count.intValue();
18871 }
18872
18873
18882 public int filterCountByG_C_T(long groupId, long classNameId,
18883 String templateId) throws SystemException {
18884 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
18885 return countByG_C_T(groupId, classNameId, templateId);
18886 }
18887
18888 StringBundler query = new StringBundler(4);
18889
18890 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
18891
18892 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
18893
18894 query.append(_FINDER_COLUMN_G_C_T_CLASSNAMEID_2);
18895
18896 if (templateId == null) {
18897 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_1);
18898 }
18899 else {
18900 if (templateId.equals(StringPool.BLANK)) {
18901 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_3);
18902 }
18903 else {
18904 query.append(_FINDER_COLUMN_G_C_T_TEMPLATEID_2);
18905 }
18906 }
18907
18908 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
18909 JournalArticle.class.getName(),
18910 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
18911
18912 Session session = null;
18913
18914 try {
18915 session = openSession();
18916
18917 SQLQuery q = session.createSQLQuery(sql);
18918
18919 q.addScalar(COUNT_COLUMN_NAME,
18920 com.liferay.portal.kernel.dao.orm.Type.LONG);
18921
18922 QueryPos qPos = QueryPos.getInstance(q);
18923
18924 qPos.add(groupId);
18925
18926 qPos.add(classNameId);
18927
18928 if (templateId != null) {
18929 qPos.add(templateId);
18930 }
18931
18932 Long count = (Long)q.uniqueResult();
18933
18934 return count.intValue();
18935 }
18936 catch (Exception e) {
18937 throw processException(e);
18938 }
18939 finally {
18940 closeSession(session);
18941 }
18942 }
18943
18944
18953 public int countByG_C_L(long groupId, long classNameId, String layoutUuid)
18954 throws SystemException {
18955 Object[] finderArgs = new Object[] { groupId, classNameId, layoutUuid };
18956
18957 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_L,
18958 finderArgs, this);
18959
18960 if (count == null) {
18961 StringBundler query = new StringBundler(4);
18962
18963 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
18964
18965 query.append(_FINDER_COLUMN_G_C_L_GROUPID_2);
18966
18967 query.append(_FINDER_COLUMN_G_C_L_CLASSNAMEID_2);
18968
18969 if (layoutUuid == null) {
18970 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_1);
18971 }
18972 else {
18973 if (layoutUuid.equals(StringPool.BLANK)) {
18974 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_3);
18975 }
18976 else {
18977 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_2);
18978 }
18979 }
18980
18981 String sql = query.toString();
18982
18983 Session session = null;
18984
18985 try {
18986 session = openSession();
18987
18988 Query q = session.createQuery(sql);
18989
18990 QueryPos qPos = QueryPos.getInstance(q);
18991
18992 qPos.add(groupId);
18993
18994 qPos.add(classNameId);
18995
18996 if (layoutUuid != null) {
18997 qPos.add(layoutUuid);
18998 }
18999
19000 count = (Long)q.uniqueResult();
19001 }
19002 catch (Exception e) {
19003 throw processException(e);
19004 }
19005 finally {
19006 if (count == null) {
19007 count = Long.valueOf(0);
19008 }
19009
19010 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_L,
19011 finderArgs, count);
19012
19013 closeSession(session);
19014 }
19015 }
19016
19017 return count.intValue();
19018 }
19019
19020
19029 public int filterCountByG_C_L(long groupId, long classNameId,
19030 String layoutUuid) throws SystemException {
19031 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
19032 return countByG_C_L(groupId, classNameId, layoutUuid);
19033 }
19034
19035 StringBundler query = new StringBundler(4);
19036
19037 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
19038
19039 query.append(_FINDER_COLUMN_G_C_L_GROUPID_2);
19040
19041 query.append(_FINDER_COLUMN_G_C_L_CLASSNAMEID_2);
19042
19043 if (layoutUuid == null) {
19044 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_1);
19045 }
19046 else {
19047 if (layoutUuid.equals(StringPool.BLANK)) {
19048 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_3);
19049 }
19050 else {
19051 query.append(_FINDER_COLUMN_G_C_L_LAYOUTUUID_2);
19052 }
19053 }
19054
19055 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
19056 JournalArticle.class.getName(),
19057 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
19058
19059 Session session = null;
19060
19061 try {
19062 session = openSession();
19063
19064 SQLQuery q = session.createSQLQuery(sql);
19065
19066 q.addScalar(COUNT_COLUMN_NAME,
19067 com.liferay.portal.kernel.dao.orm.Type.LONG);
19068
19069 QueryPos qPos = QueryPos.getInstance(q);
19070
19071 qPos.add(groupId);
19072
19073 qPos.add(classNameId);
19074
19075 if (layoutUuid != null) {
19076 qPos.add(layoutUuid);
19077 }
19078
19079 Long count = (Long)q.uniqueResult();
19080
19081 return count.intValue();
19082 }
19083 catch (Exception e) {
19084 throw processException(e);
19085 }
19086 finally {
19087 closeSession(session);
19088 }
19089 }
19090
19091
19100 public int countByG_A_V(long groupId, String articleId, double version)
19101 throws SystemException {
19102 Object[] finderArgs = new Object[] { groupId, articleId, version };
19103
19104 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A_V,
19105 finderArgs, this);
19106
19107 if (count == null) {
19108 StringBundler query = new StringBundler(4);
19109
19110 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
19111
19112 query.append(_FINDER_COLUMN_G_A_V_GROUPID_2);
19113
19114 if (articleId == null) {
19115 query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_1);
19116 }
19117 else {
19118 if (articleId.equals(StringPool.BLANK)) {
19119 query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_3);
19120 }
19121 else {
19122 query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_2);
19123 }
19124 }
19125
19126 query.append(_FINDER_COLUMN_G_A_V_VERSION_2);
19127
19128 String sql = query.toString();
19129
19130 Session session = null;
19131
19132 try {
19133 session = openSession();
19134
19135 Query q = session.createQuery(sql);
19136
19137 QueryPos qPos = QueryPos.getInstance(q);
19138
19139 qPos.add(groupId);
19140
19141 if (articleId != null) {
19142 qPos.add(articleId);
19143 }
19144
19145 qPos.add(version);
19146
19147 count = (Long)q.uniqueResult();
19148 }
19149 catch (Exception e) {
19150 throw processException(e);
19151 }
19152 finally {
19153 if (count == null) {
19154 count = Long.valueOf(0);
19155 }
19156
19157 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_V,
19158 finderArgs, count);
19159
19160 closeSession(session);
19161 }
19162 }
19163
19164 return count.intValue();
19165 }
19166
19167
19176 public int countByG_A_ST(long groupId, String articleId, int status)
19177 throws SystemException {
19178 Object[] finderArgs = new Object[] { groupId, articleId, status };
19179
19180 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A_ST,
19181 finderArgs, this);
19182
19183 if (count == null) {
19184 StringBundler query = new StringBundler(4);
19185
19186 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
19187
19188 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_2);
19189
19190 if (articleId == null) {
19191 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_1);
19192 }
19193 else {
19194 if (articleId.equals(StringPool.BLANK)) {
19195 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_3);
19196 }
19197 else {
19198 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_2);
19199 }
19200 }
19201
19202 query.append(_FINDER_COLUMN_G_A_ST_STATUS_2);
19203
19204 String sql = query.toString();
19205
19206 Session session = null;
19207
19208 try {
19209 session = openSession();
19210
19211 Query q = session.createQuery(sql);
19212
19213 QueryPos qPos = QueryPos.getInstance(q);
19214
19215 qPos.add(groupId);
19216
19217 if (articleId != null) {
19218 qPos.add(articleId);
19219 }
19220
19221 qPos.add(status);
19222
19223 count = (Long)q.uniqueResult();
19224 }
19225 catch (Exception e) {
19226 throw processException(e);
19227 }
19228 finally {
19229 if (count == null) {
19230 count = Long.valueOf(0);
19231 }
19232
19233 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_ST,
19234 finderArgs, count);
19235
19236 closeSession(session);
19237 }
19238 }
19239
19240 return count.intValue();
19241 }
19242
19243
19252 public int countByG_A_ST(long groupId, String articleId, int[] statuses)
19253 throws SystemException {
19254 Object[] finderArgs = new Object[] {
19255 groupId, articleId, StringUtil.merge(statuses)
19256 };
19257
19258 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_A_ST,
19259 finderArgs, this);
19260
19261 if (count == null) {
19262 StringBundler query = new StringBundler();
19263
19264 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
19265
19266 boolean conjunctionable = false;
19267
19268 if (conjunctionable) {
19269 query.append(WHERE_AND);
19270 }
19271
19272 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_5);
19273
19274 conjunctionable = true;
19275
19276 if (conjunctionable) {
19277 query.append(WHERE_AND);
19278 }
19279
19280 if (articleId == null) {
19281 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_4);
19282 }
19283 else {
19284 if (articleId.equals(StringPool.BLANK)) {
19285 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_6);
19286 }
19287 else {
19288 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_5);
19289 }
19290 }
19291
19292 conjunctionable = true;
19293
19294 if ((statuses == null) || (statuses.length > 0)) {
19295 if (conjunctionable) {
19296 query.append(WHERE_AND);
19297 }
19298
19299 query.append(StringPool.OPEN_PARENTHESIS);
19300
19301 for (int i = 0; i < statuses.length; i++) {
19302 query.append(_FINDER_COLUMN_G_A_ST_STATUS_5);
19303
19304 if ((i + 1) < statuses.length) {
19305 query.append(WHERE_OR);
19306 }
19307 }
19308
19309 query.append(StringPool.CLOSE_PARENTHESIS);
19310
19311 conjunctionable = true;
19312 }
19313
19314 String sql = query.toString();
19315
19316 Session session = null;
19317
19318 try {
19319 session = openSession();
19320
19321 Query q = session.createQuery(sql);
19322
19323 QueryPos qPos = QueryPos.getInstance(q);
19324
19325 qPos.add(groupId);
19326
19327 if (articleId != null) {
19328 qPos.add(articleId);
19329 }
19330
19331 if (statuses != null) {
19332 qPos.add(statuses);
19333 }
19334
19335 count = (Long)q.uniqueResult();
19336 }
19337 catch (Exception e) {
19338 throw processException(e);
19339 }
19340 finally {
19341 if (count == null) {
19342 count = Long.valueOf(0);
19343 }
19344
19345 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_A_ST,
19346 finderArgs, count);
19347
19348 closeSession(session);
19349 }
19350 }
19351
19352 return count.intValue();
19353 }
19354
19355
19364 public int filterCountByG_A_ST(long groupId, String articleId, int status)
19365 throws SystemException {
19366 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
19367 return countByG_A_ST(groupId, articleId, status);
19368 }
19369
19370 StringBundler query = new StringBundler(4);
19371
19372 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
19373
19374 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_2);
19375
19376 if (articleId == null) {
19377 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_1);
19378 }
19379 else {
19380 if (articleId.equals(StringPool.BLANK)) {
19381 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_3);
19382 }
19383 else {
19384 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_2);
19385 }
19386 }
19387
19388 query.append(_FINDER_COLUMN_G_A_ST_STATUS_2);
19389
19390 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
19391 JournalArticle.class.getName(),
19392 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
19393
19394 Session session = null;
19395
19396 try {
19397 session = openSession();
19398
19399 SQLQuery q = session.createSQLQuery(sql);
19400
19401 q.addScalar(COUNT_COLUMN_NAME,
19402 com.liferay.portal.kernel.dao.orm.Type.LONG);
19403
19404 QueryPos qPos = QueryPos.getInstance(q);
19405
19406 qPos.add(groupId);
19407
19408 if (articleId != null) {
19409 qPos.add(articleId);
19410 }
19411
19412 qPos.add(status);
19413
19414 Long count = (Long)q.uniqueResult();
19415
19416 return count.intValue();
19417 }
19418 catch (Exception e) {
19419 throw processException(e);
19420 }
19421 finally {
19422 closeSession(session);
19423 }
19424 }
19425
19426
19435 public int filterCountByG_A_ST(long groupId, String articleId,
19436 int[] statuses) throws SystemException {
19437 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
19438 return countByG_A_ST(groupId, articleId, statuses);
19439 }
19440
19441 StringBundler query = new StringBundler();
19442
19443 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
19444
19445 boolean conjunctionable = false;
19446
19447 if (conjunctionable) {
19448 query.append(WHERE_AND);
19449 }
19450
19451 query.append(_FINDER_COLUMN_G_A_ST_GROUPID_5);
19452
19453 conjunctionable = true;
19454
19455 if (conjunctionable) {
19456 query.append(WHERE_AND);
19457 }
19458
19459 if (articleId == null) {
19460 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_4);
19461 }
19462 else {
19463 if (articleId.equals(StringPool.BLANK)) {
19464 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_6);
19465 }
19466 else {
19467 query.append(_FINDER_COLUMN_G_A_ST_ARTICLEID_5);
19468 }
19469 }
19470
19471 conjunctionable = true;
19472
19473 if ((statuses == null) || (statuses.length > 0)) {
19474 if (conjunctionable) {
19475 query.append(WHERE_AND);
19476 }
19477
19478 query.append(StringPool.OPEN_PARENTHESIS);
19479
19480 for (int i = 0; i < statuses.length; i++) {
19481 query.append(_FINDER_COLUMN_G_A_ST_STATUS_5);
19482
19483 if ((i + 1) < statuses.length) {
19484 query.append(WHERE_OR);
19485 }
19486 }
19487
19488 query.append(StringPool.CLOSE_PARENTHESIS);
19489
19490 conjunctionable = true;
19491 }
19492
19493 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
19494 JournalArticle.class.getName(),
19495 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
19496
19497 Session session = null;
19498
19499 try {
19500 session = openSession();
19501
19502 SQLQuery q = session.createSQLQuery(sql);
19503
19504 q.addScalar(COUNT_COLUMN_NAME,
19505 com.liferay.portal.kernel.dao.orm.Type.LONG);
19506
19507 QueryPos qPos = QueryPos.getInstance(q);
19508
19509 qPos.add(groupId);
19510
19511 if (articleId != null) {
19512 qPos.add(articleId);
19513 }
19514
19515 if (statuses != null) {
19516 qPos.add(statuses);
19517 }
19518
19519 Long count = (Long)q.uniqueResult();
19520
19521 return count.intValue();
19522 }
19523 catch (Exception e) {
19524 throw processException(e);
19525 }
19526 finally {
19527 closeSession(session);
19528 }
19529 }
19530
19531
19540 public int countByG_UT_ST(long groupId, String urlTitle, int status)
19541 throws SystemException {
19542 Object[] finderArgs = new Object[] { groupId, urlTitle, status };
19543
19544 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT_ST,
19545 finderArgs, this);
19546
19547 if (count == null) {
19548 StringBundler query = new StringBundler(4);
19549
19550 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
19551
19552 query.append(_FINDER_COLUMN_G_UT_ST_GROUPID_2);
19553
19554 if (urlTitle == null) {
19555 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_1);
19556 }
19557 else {
19558 if (urlTitle.equals(StringPool.BLANK)) {
19559 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_3);
19560 }
19561 else {
19562 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_2);
19563 }
19564 }
19565
19566 query.append(_FINDER_COLUMN_G_UT_ST_STATUS_2);
19567
19568 String sql = query.toString();
19569
19570 Session session = null;
19571
19572 try {
19573 session = openSession();
19574
19575 Query q = session.createQuery(sql);
19576
19577 QueryPos qPos = QueryPos.getInstance(q);
19578
19579 qPos.add(groupId);
19580
19581 if (urlTitle != null) {
19582 qPos.add(urlTitle);
19583 }
19584
19585 qPos.add(status);
19586
19587 count = (Long)q.uniqueResult();
19588 }
19589 catch (Exception e) {
19590 throw processException(e);
19591 }
19592 finally {
19593 if (count == null) {
19594 count = Long.valueOf(0);
19595 }
19596
19597 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT_ST,
19598 finderArgs, count);
19599
19600 closeSession(session);
19601 }
19602 }
19603
19604 return count.intValue();
19605 }
19606
19607
19616 public int filterCountByG_UT_ST(long groupId, String urlTitle, int status)
19617 throws SystemException {
19618 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
19619 return countByG_UT_ST(groupId, urlTitle, status);
19620 }
19621
19622 StringBundler query = new StringBundler(4);
19623
19624 query.append(_FILTER_SQL_COUNT_JOURNALARTICLE_WHERE);
19625
19626 query.append(_FINDER_COLUMN_G_UT_ST_GROUPID_2);
19627
19628 if (urlTitle == null) {
19629 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_1);
19630 }
19631 else {
19632 if (urlTitle.equals(StringPool.BLANK)) {
19633 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_3);
19634 }
19635 else {
19636 query.append(_FINDER_COLUMN_G_UT_ST_URLTITLE_2);
19637 }
19638 }
19639
19640 query.append(_FINDER_COLUMN_G_UT_ST_STATUS_2);
19641
19642 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
19643 JournalArticle.class.getName(),
19644 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
19645
19646 Session session = null;
19647
19648 try {
19649 session = openSession();
19650
19651 SQLQuery q = session.createSQLQuery(sql);
19652
19653 q.addScalar(COUNT_COLUMN_NAME,
19654 com.liferay.portal.kernel.dao.orm.Type.LONG);
19655
19656 QueryPos qPos = QueryPos.getInstance(q);
19657
19658 qPos.add(groupId);
19659
19660 if (urlTitle != null) {
19661 qPos.add(urlTitle);
19662 }
19663
19664 qPos.add(status);
19665
19666 Long count = (Long)q.uniqueResult();
19667
19668 return count.intValue();
19669 }
19670 catch (Exception e) {
19671 throw processException(e);
19672 }
19673 finally {
19674 closeSession(session);
19675 }
19676 }
19677
19678
19687 public int countByC_V_ST(long companyId, double version, int status)
19688 throws SystemException {
19689 Object[] finderArgs = new Object[] { companyId, version, status };
19690
19691 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_V_ST,
19692 finderArgs, this);
19693
19694 if (count == null) {
19695 StringBundler query = new StringBundler(4);
19696
19697 query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
19698
19699 query.append(_FINDER_COLUMN_C_V_ST_COMPANYID_2);
19700
19701 query.append(_FINDER_COLUMN_C_V_ST_VERSION_2);
19702
19703 query.append(_FINDER_COLUMN_C_V_ST_STATUS_2);
19704
19705 String sql = query.toString();
19706
19707 Session session = null;
19708
19709 try {
19710 session = openSession();
19711
19712 Query q = session.createQuery(sql);
19713
19714 QueryPos qPos = QueryPos.getInstance(q);
19715
19716 qPos.add(companyId);
19717
19718 qPos.add(version);
19719
19720 qPos.add(status);
19721
19722 count = (Long)q.uniqueResult();
19723 }
19724 catch (Exception e) {
19725 throw processException(e);
19726 }
19727 finally {
19728 if (count == null) {
19729 count = Long.valueOf(0);
19730 }
19731
19732 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_V_ST,
19733 finderArgs, count);
19734
19735 closeSession(session);
19736 }
19737 }
19738
19739 return count.intValue();
19740 }
19741
19742
19748 public int countAll() throws SystemException {
19749 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
19750 FINDER_ARGS_EMPTY, this);
19751
19752 if (count == null) {
19753 Session session = null;
19754
19755 try {
19756 session = openSession();
19757
19758 Query q = session.createQuery(_SQL_COUNT_JOURNALARTICLE);
19759
19760 count = (Long)q.uniqueResult();
19761 }
19762 catch (Exception e) {
19763 throw processException(e);
19764 }
19765 finally {
19766 if (count == null) {
19767 count = Long.valueOf(0);
19768 }
19769
19770 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
19771 FINDER_ARGS_EMPTY, count);
19772
19773 closeSession(session);
19774 }
19775 }
19776
19777 return count.intValue();
19778 }
19779
19780
19783 public void afterPropertiesSet() {
19784 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
19785 com.liferay.portal.util.PropsUtil.get(
19786 "value.object.listener.com.liferay.portlet.journal.model.JournalArticle")));
19787
19788 if (listenerClassNames.length > 0) {
19789 try {
19790 List<ModelListener<JournalArticle>> listenersList = new ArrayList<ModelListener<JournalArticle>>();
19791
19792 for (String listenerClassName : listenerClassNames) {
19793 Class<?> clazz = getClass();
19794
19795 listenersList.add((ModelListener<JournalArticle>)InstanceFactory.newInstance(
19796 clazz.getClassLoader(), listenerClassName));
19797 }
19798
19799 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
19800 }
19801 catch (Exception e) {
19802 _log.error(e);
19803 }
19804 }
19805 }
19806
19807 public void destroy() {
19808 EntityCacheUtil.removeCache(JournalArticleImpl.class.getName());
19809 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
19810 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
19811 }
19812
19813 @BeanReference(type = JournalArticlePersistence.class)
19814 protected JournalArticlePersistence journalArticlePersistence;
19815 @BeanReference(type = JournalArticleImagePersistence.class)
19816 protected JournalArticleImagePersistence journalArticleImagePersistence;
19817 @BeanReference(type = JournalArticleResourcePersistence.class)
19818 protected JournalArticleResourcePersistence journalArticleResourcePersistence;
19819 @BeanReference(type = JournalContentSearchPersistence.class)
19820 protected JournalContentSearchPersistence journalContentSearchPersistence;
19821 @BeanReference(type = JournalFeedPersistence.class)
19822 protected JournalFeedPersistence journalFeedPersistence;
19823 @BeanReference(type = JournalStructurePersistence.class)
19824 protected JournalStructurePersistence journalStructurePersistence;
19825 @BeanReference(type = JournalTemplatePersistence.class)
19826 protected JournalTemplatePersistence journalTemplatePersistence;
19827 @BeanReference(type = CompanyPersistence.class)
19828 protected CompanyPersistence companyPersistence;
19829 @BeanReference(type = GroupPersistence.class)
19830 protected GroupPersistence groupPersistence;
19831 @BeanReference(type = ImagePersistence.class)
19832 protected ImagePersistence imagePersistence;
19833 @BeanReference(type = PortletPreferencesPersistence.class)
19834 protected PortletPreferencesPersistence portletPreferencesPersistence;
19835 @BeanReference(type = ResourcePersistence.class)
19836 protected ResourcePersistence resourcePersistence;
19837 @BeanReference(type = SubscriptionPersistence.class)
19838 protected SubscriptionPersistence subscriptionPersistence;
19839 @BeanReference(type = UserPersistence.class)
19840 protected UserPersistence userPersistence;
19841 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
19842 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
19843 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
19844 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
19845 @BeanReference(type = AssetCategoryPersistence.class)
19846 protected AssetCategoryPersistence assetCategoryPersistence;
19847 @BeanReference(type = AssetEntryPersistence.class)
19848 protected AssetEntryPersistence assetEntryPersistence;
19849 @BeanReference(type = AssetLinkPersistence.class)
19850 protected AssetLinkPersistence assetLinkPersistence;
19851 @BeanReference(type = AssetTagPersistence.class)
19852 protected AssetTagPersistence assetTagPersistence;
19853 @BeanReference(type = ExpandoValuePersistence.class)
19854 protected ExpandoValuePersistence expandoValuePersistence;
19855 @BeanReference(type = MBMessagePersistence.class)
19856 protected MBMessagePersistence mbMessagePersistence;
19857 @BeanReference(type = RatingsStatsPersistence.class)
19858 protected RatingsStatsPersistence ratingsStatsPersistence;
19859 private static final String _SQL_SELECT_JOURNALARTICLE = "SELECT journalArticle FROM JournalArticle journalArticle";
19860 private static final String _SQL_SELECT_JOURNALARTICLE_WHERE = "SELECT journalArticle FROM JournalArticle journalArticle WHERE ";
19861 private static final String _SQL_COUNT_JOURNALARTICLE = "SELECT COUNT(journalArticle) FROM JournalArticle journalArticle";
19862 private static final String _SQL_COUNT_JOURNALARTICLE_WHERE = "SELECT COUNT(journalArticle) FROM JournalArticle journalArticle WHERE ";
19863 private static final String _FINDER_COLUMN_UUID_UUID_1 = "journalArticle.uuid IS NULL";
19864 private static final String _FINDER_COLUMN_UUID_UUID_2 = "journalArticle.uuid = ?";
19865 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(journalArticle.uuid IS NULL OR journalArticle.uuid = ?)";
19866 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "journalArticle.uuid IS NULL AND ";
19867 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "journalArticle.uuid = ? AND ";
19868 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(journalArticle.uuid IS NULL OR journalArticle.uuid = ?) AND ";
19869 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "journalArticle.groupId = ?";
19870 private static final String _FINDER_COLUMN_RESOURCEPRIMKEY_RESOURCEPRIMKEY_2 =
19871 "journalArticle.resourcePrimKey = ?";
19872 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalArticle.groupId = ?";
19873 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "journalArticle.companyId = ?";
19874 private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_1 = "journalArticle.structureId IS NULL";
19875 private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2 = "journalArticle.structureId = ?";
19876 private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_3 = "(journalArticle.structureId IS NULL OR journalArticle.structureId = ?)";
19877 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1 = "journalArticle.templateId IS NULL";
19878 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2 = "journalArticle.templateId = ?";
19879 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3 = "(journalArticle.templateId IS NULL OR journalArticle.templateId = ?)";
19880 private static final String _FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_1 = "journalArticle.layoutUuid IS NULL";
19881 private static final String _FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_2 = "journalArticle.layoutUuid = ?";
19882 private static final String _FINDER_COLUMN_LAYOUTUUID_LAYOUTUUID_3 = "(journalArticle.layoutUuid IS NULL OR journalArticle.layoutUuid = ?)";
19883 private static final String _FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2 = "journalArticle.smallImageId = ?";
19884 private static final String _FINDER_COLUMN_R_ST_RESOURCEPRIMKEY_2 = "journalArticle.resourcePrimKey = ? AND ";
19885 private static final String _FINDER_COLUMN_R_ST_STATUS_2 = "journalArticle.status = ?";
19886 private static final String _FINDER_COLUMN_G_A_GROUPID_2 = "journalArticle.groupId = ? AND ";
19887 private static final String _FINDER_COLUMN_G_A_ARTICLEID_1 = "journalArticle.articleId IS NULL";
19888 private static final String _FINDER_COLUMN_G_A_ARTICLEID_2 = "journalArticle.articleId = ?";
19889 private static final String _FINDER_COLUMN_G_A_ARTICLEID_3 = "(journalArticle.articleId IS NULL OR journalArticle.articleId = ?)";
19890 private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "journalArticle.groupId = ? AND ";
19891 private static final String _FINDER_COLUMN_G_UT_URLTITLE_1 = "journalArticle.urlTitle IS NULL";
19892 private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "journalArticle.urlTitle = ?";
19893 private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(journalArticle.urlTitle IS NULL OR journalArticle.urlTitle = ?)";
19894 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "journalArticle.groupId = ? AND ";
19895 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_1 = "journalArticle.structureId IS NULL";
19896 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_2 = "journalArticle.structureId = ?";
19897 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_3 = "(journalArticle.structureId IS NULL OR journalArticle.structureId = ?)";
19898 private static final String _FINDER_COLUMN_G_T_GROUPID_2 = "journalArticle.groupId = ? AND ";
19899 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_1 = "journalArticle.templateId IS NULL";
19900 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_2 = "journalArticle.templateId = ?";
19901 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_3 = "(journalArticle.templateId IS NULL OR journalArticle.templateId = ?)";
19902 private static final String _FINDER_COLUMN_G_L_GROUPID_2 = "journalArticle.groupId = ? AND ";
19903 private static final String _FINDER_COLUMN_G_L_LAYOUTUUID_1 = "journalArticle.layoutUuid IS NULL";
19904 private static final String _FINDER_COLUMN_G_L_LAYOUTUUID_2 = "journalArticle.layoutUuid = ?";
19905 private static final String _FINDER_COLUMN_G_L_LAYOUTUUID_3 = "(journalArticle.layoutUuid IS NULL OR journalArticle.layoutUuid = ?)";
19906 private static final String _FINDER_COLUMN_G_ST_GROUPID_2 = "journalArticle.groupId = ? AND ";
19907 private static final String _FINDER_COLUMN_G_ST_STATUS_2 = "journalArticle.status = ?";
19908 private static final String _FINDER_COLUMN_C_V_COMPANYID_2 = "journalArticle.companyId = ? AND ";
19909 private static final String _FINDER_COLUMN_C_V_VERSION_2 = "journalArticle.version = ?";
19910 private static final String _FINDER_COLUMN_C_ST_COMPANYID_2 = "journalArticle.companyId = ? AND ";
19911 private static final String _FINDER_COLUMN_C_ST_STATUS_2 = "journalArticle.status = ?";
19912 private static final String _FINDER_COLUMN_G_C_C_GROUPID_2 = "journalArticle.groupId = ? AND ";
19913 private static final String _FINDER_COLUMN_G_C_C_CLASSNAMEID_2 = "journalArticle.classNameId = ? AND ";
19914 private static final String _FINDER_COLUMN_G_C_C_CLASSPK_2 = "journalArticle.classPK = ?";
19915 private static final String _FINDER_COLUMN_G_C_S_GROUPID_2 = "journalArticle.groupId = ? AND ";
19916 private static final String _FINDER_COLUMN_G_C_S_CLASSNAMEID_2 = "journalArticle.classNameId = ? AND ";
19917 private static final String _FINDER_COLUMN_G_C_S_STRUCTUREID_1 = "journalArticle.structureId IS NULL";
19918 private static final String _FINDER_COLUMN_G_C_S_STRUCTUREID_2 = "journalArticle.structureId = ?";
19919 private static final String _FINDER_COLUMN_G_C_S_STRUCTUREID_3 = "(journalArticle.structureId IS NULL OR journalArticle.structureId = ?)";
19920 private static final String _FINDER_COLUMN_G_C_T_GROUPID_2 = "journalArticle.groupId = ? AND ";
19921 private static final String _FINDER_COLUMN_G_C_T_CLASSNAMEID_2 = "journalArticle.classNameId = ? AND ";
19922 private static final String _FINDER_COLUMN_G_C_T_TEMPLATEID_1 = "journalArticle.templateId IS NULL";
19923 private static final String _FINDER_COLUMN_G_C_T_TEMPLATEID_2 = "journalArticle.templateId = ?";
19924 private static final String _FINDER_COLUMN_G_C_T_TEMPLATEID_3 = "(journalArticle.templateId IS NULL OR journalArticle.templateId = ?)";
19925 private static final String _FINDER_COLUMN_G_C_L_GROUPID_2 = "journalArticle.groupId = ? AND ";
19926 private static final String _FINDER_COLUMN_G_C_L_CLASSNAMEID_2 = "journalArticle.classNameId = ? AND ";
19927 private static final String _FINDER_COLUMN_G_C_L_LAYOUTUUID_1 = "journalArticle.layoutUuid IS NULL";
19928 private static final String _FINDER_COLUMN_G_C_L_LAYOUTUUID_2 = "journalArticle.layoutUuid = ?";
19929 private static final String _FINDER_COLUMN_G_C_L_LAYOUTUUID_3 = "(journalArticle.layoutUuid IS NULL OR journalArticle.layoutUuid = ?)";
19930 private static final String _FINDER_COLUMN_G_A_V_GROUPID_2 = "journalArticle.groupId = ? AND ";
19931 private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_1 = "journalArticle.articleId IS NULL AND ";
19932 private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_2 = "journalArticle.articleId = ? AND ";
19933 private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_3 = "(journalArticle.articleId IS NULL OR journalArticle.articleId = ?) AND ";
19934 private static final String _FINDER_COLUMN_G_A_V_VERSION_2 = "journalArticle.version = ?";
19935 private static final String _FINDER_COLUMN_G_A_ST_GROUPID_2 = "journalArticle.groupId = ? AND ";
19936 private static final String _FINDER_COLUMN_G_A_ST_GROUPID_5 = "(" +
19937 _removeConjunction(_FINDER_COLUMN_G_A_ST_GROUPID_2) + ")";
19938 private static final String _FINDER_COLUMN_G_A_ST_ARTICLEID_1 = "journalArticle.articleId IS NULL AND ";
19939 private static final String _FINDER_COLUMN_G_A_ST_ARTICLEID_2 = "journalArticle.articleId = ? AND ";
19940 private static final String _FINDER_COLUMN_G_A_ST_ARTICLEID_3 = "(journalArticle.articleId IS NULL OR journalArticle.articleId = ?) AND ";
19941 private static final String _FINDER_COLUMN_G_A_ST_ARTICLEID_4 = "(" +
19942 _removeConjunction(_FINDER_COLUMN_G_A_ST_ARTICLEID_1) + ")";
19943 private static final String _FINDER_COLUMN_G_A_ST_ARTICLEID_5 = "(" +
19944 _removeConjunction(_FINDER_COLUMN_G_A_ST_ARTICLEID_2) + ")";
19945 private static final String _FINDER_COLUMN_G_A_ST_ARTICLEID_6 = "(" +
19946 _removeConjunction(_FINDER_COLUMN_G_A_ST_ARTICLEID_3) + ")";
19947 private static final String _FINDER_COLUMN_G_A_ST_STATUS_2 = "journalArticle.status = ?";
19948 private static final String _FINDER_COLUMN_G_A_ST_STATUS_5 = "(" +
19949 _removeConjunction(_FINDER_COLUMN_G_A_ST_STATUS_2) + ")";
19950 private static final String _FINDER_COLUMN_G_UT_ST_GROUPID_2 = "journalArticle.groupId = ? AND ";
19951 private static final String _FINDER_COLUMN_G_UT_ST_URLTITLE_1 = "journalArticle.urlTitle IS NULL AND ";
19952 private static final String _FINDER_COLUMN_G_UT_ST_URLTITLE_2 = "journalArticle.urlTitle = ? AND ";
19953 private static final String _FINDER_COLUMN_G_UT_ST_URLTITLE_3 = "(journalArticle.urlTitle IS NULL OR journalArticle.urlTitle = ?) AND ";
19954 private static final String _FINDER_COLUMN_G_UT_ST_STATUS_2 = "journalArticle.status = ?";
19955 private static final String _FINDER_COLUMN_C_V_ST_COMPANYID_2 = "journalArticle.companyId = ? AND ";
19956 private static final String _FINDER_COLUMN_C_V_ST_VERSION_2 = "journalArticle.version = ? AND ";
19957 private static final String _FINDER_COLUMN_C_V_ST_STATUS_2 = "journalArticle.status = ?";
19958
19959 private static String _removeConjunction(String sql) {
19960 int pos = sql.indexOf(" AND ");
19961
19962 if (pos != -1) {
19963 sql = sql.substring(0, pos);
19964 }
19965
19966 return sql;
19967 }
19968
19969 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "journalArticle.resourcePrimKey";
19970 private static final String _FILTER_SQL_SELECT_JOURNALARTICLE_WHERE = "SELECT DISTINCT {journalArticle.*} FROM JournalArticle journalArticle WHERE ";
19971 private static final String _FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_1 =
19972 "SELECT {JournalArticle.*} FROM (SELECT DISTINCT journalArticle.id_ FROM JournalArticle journalArticle WHERE ";
19973 private static final String _FILTER_SQL_SELECT_JOURNALARTICLE_NO_INLINE_DISTINCT_WHERE_2 =
19974 ") TEMP_TABLE INNER JOIN JournalArticle ON TEMP_TABLE.id_ = JournalArticle.id_";
19975 private static final String _FILTER_SQL_COUNT_JOURNALARTICLE_WHERE = "SELECT COUNT(DISTINCT journalArticle.id_) AS COUNT_VALUE FROM JournalArticle journalArticle WHERE ";
19976 private static final String _FILTER_ENTITY_ALIAS = "journalArticle";
19977 private static final String _FILTER_ENTITY_TABLE = "JournalArticle";
19978 private static final String _ORDER_BY_ENTITY_ALIAS = "journalArticle.";
19979 private static final String _ORDER_BY_ENTITY_TABLE = "JournalArticle.";
19980 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalArticle exists with the primary key ";
19981 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalArticle exists with the key {";
19982 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
19983 private static Log _log = LogFactoryUtil.getLog(JournalArticlePersistenceImpl.class);
19984 private static JournalArticle _nullJournalArticle = new JournalArticleImpl() {
19985 @Override
19986 public Object clone() {
19987 return this;
19988 }
19989
19990 @Override
19991 public CacheModel<JournalArticle> toCacheModel() {
19992 return _nullJournalArticleCacheModel;
19993 }
19994 };
19995
19996 private static CacheModel<JournalArticle> _nullJournalArticleCacheModel = new CacheModel<JournalArticle>() {
19997 public JournalArticle toEntityModel() {
19998 return _nullJournalArticle;
19999 }
20000 };
20001 }