1
22
23 package com.liferay.portlet.journal.service.persistence;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.kernel.util.Validator;
27 import com.liferay.portal.model.ModelListener;
28 import com.liferay.portal.util.PropsUtil;
29
30 import org.apache.commons.logging.Log;
31 import org.apache.commons.logging.LogFactory;
32
33
39 public class JournalTemplateUtil {
40 public static com.liferay.portlet.journal.model.JournalTemplate create(
41 long id) {
42 return getPersistence().create(id);
43 }
44
45 public static com.liferay.portlet.journal.model.JournalTemplate remove(
46 long id)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portlet.journal.NoSuchTemplateException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(id));
53 }
54
55 com.liferay.portlet.journal.model.JournalTemplate journalTemplate = getPersistence()
56 .remove(id);
57
58 if (listener != null) {
59 listener.onAfterRemove(journalTemplate);
60 }
61
62 return journalTemplate;
63 }
64
65 public static com.liferay.portlet.journal.model.JournalTemplate remove(
66 com.liferay.portlet.journal.model.JournalTemplate journalTemplate)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(journalTemplate);
72 }
73
74 journalTemplate = getPersistence().remove(journalTemplate);
75
76 if (listener != null) {
77 listener.onAfterRemove(journalTemplate);
78 }
79
80 return journalTemplate;
81 }
82
83 public static com.liferay.portlet.journal.model.JournalTemplate update(
84 com.liferay.portlet.journal.model.JournalTemplate journalTemplate)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = journalTemplate.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(journalTemplate);
92 }
93 else {
94 listener.onBeforeUpdate(journalTemplate);
95 }
96 }
97
98 journalTemplate = getPersistence().update(journalTemplate);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(journalTemplate);
103 }
104 else {
105 listener.onAfterUpdate(journalTemplate);
106 }
107 }
108
109 return journalTemplate;
110 }
111
112 public static com.liferay.portlet.journal.model.JournalTemplate update(
113 com.liferay.portlet.journal.model.JournalTemplate journalTemplate,
114 boolean merge) throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = journalTemplate.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(journalTemplate);
121 }
122 else {
123 listener.onBeforeUpdate(journalTemplate);
124 }
125 }
126
127 journalTemplate = getPersistence().update(journalTemplate, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(journalTemplate);
132 }
133 else {
134 listener.onAfterUpdate(journalTemplate);
135 }
136 }
137
138 return journalTemplate;
139 }
140
141 public static com.liferay.portlet.journal.model.JournalTemplate findByPrimaryKey(
142 long id)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portlet.journal.NoSuchTemplateException {
145 return getPersistence().findByPrimaryKey(id);
146 }
147
148 public static com.liferay.portlet.journal.model.JournalTemplate fetchByPrimaryKey(
149 long id) throws com.liferay.portal.SystemException {
150 return getPersistence().fetchByPrimaryKey(id);
151 }
152
153 public static java.util.List findByGroupId(long groupId)
154 throws com.liferay.portal.SystemException {
155 return getPersistence().findByGroupId(groupId);
156 }
157
158 public static java.util.List findByGroupId(long groupId, int begin, int end)
159 throws com.liferay.portal.SystemException {
160 return getPersistence().findByGroupId(groupId, begin, end);
161 }
162
163 public static java.util.List findByGroupId(long groupId, int begin,
164 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
165 throws com.liferay.portal.SystemException {
166 return getPersistence().findByGroupId(groupId, begin, end, obc);
167 }
168
169 public static com.liferay.portlet.journal.model.JournalTemplate findByGroupId_First(
170 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
171 throws com.liferay.portal.SystemException,
172 com.liferay.portlet.journal.NoSuchTemplateException {
173 return getPersistence().findByGroupId_First(groupId, obc);
174 }
175
176 public static com.liferay.portlet.journal.model.JournalTemplate findByGroupId_Last(
177 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
178 throws com.liferay.portal.SystemException,
179 com.liferay.portlet.journal.NoSuchTemplateException {
180 return getPersistence().findByGroupId_Last(groupId, obc);
181 }
182
183 public static com.liferay.portlet.journal.model.JournalTemplate[] findByGroupId_PrevAndNext(
184 long id, long groupId,
185 com.liferay.portal.kernel.util.OrderByComparator obc)
186 throws com.liferay.portal.SystemException,
187 com.liferay.portlet.journal.NoSuchTemplateException {
188 return getPersistence().findByGroupId_PrevAndNext(id, groupId, obc);
189 }
190
191 public static java.util.List findByTemplateId(java.lang.String templateId)
192 throws com.liferay.portal.SystemException {
193 return getPersistence().findByTemplateId(templateId);
194 }
195
196 public static java.util.List findByTemplateId(java.lang.String templateId,
197 int begin, int end) throws com.liferay.portal.SystemException {
198 return getPersistence().findByTemplateId(templateId, begin, end);
199 }
200
201 public static java.util.List findByTemplateId(java.lang.String templateId,
202 int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
203 throws com.liferay.portal.SystemException {
204 return getPersistence().findByTemplateId(templateId, begin, end, obc);
205 }
206
207 public static com.liferay.portlet.journal.model.JournalTemplate findByTemplateId_First(
208 java.lang.String templateId,
209 com.liferay.portal.kernel.util.OrderByComparator obc)
210 throws com.liferay.portal.SystemException,
211 com.liferay.portlet.journal.NoSuchTemplateException {
212 return getPersistence().findByTemplateId_First(templateId, obc);
213 }
214
215 public static com.liferay.portlet.journal.model.JournalTemplate findByTemplateId_Last(
216 java.lang.String templateId,
217 com.liferay.portal.kernel.util.OrderByComparator obc)
218 throws com.liferay.portal.SystemException,
219 com.liferay.portlet.journal.NoSuchTemplateException {
220 return getPersistence().findByTemplateId_Last(templateId, obc);
221 }
222
223 public static com.liferay.portlet.journal.model.JournalTemplate[] findByTemplateId_PrevAndNext(
224 long id, java.lang.String templateId,
225 com.liferay.portal.kernel.util.OrderByComparator obc)
226 throws com.liferay.portal.SystemException,
227 com.liferay.portlet.journal.NoSuchTemplateException {
228 return getPersistence().findByTemplateId_PrevAndNext(id, templateId, obc);
229 }
230
231 public static com.liferay.portlet.journal.model.JournalTemplate findByG_T(
232 long groupId, java.lang.String templateId)
233 throws com.liferay.portal.SystemException,
234 com.liferay.portlet.journal.NoSuchTemplateException {
235 return getPersistence().findByG_T(groupId, templateId);
236 }
237
238 public static com.liferay.portlet.journal.model.JournalTemplate fetchByG_T(
239 long groupId, java.lang.String templateId)
240 throws com.liferay.portal.SystemException {
241 return getPersistence().fetchByG_T(groupId, templateId);
242 }
243
244 public static java.util.List findByG_S(long groupId,
245 java.lang.String structureId) throws com.liferay.portal.SystemException {
246 return getPersistence().findByG_S(groupId, structureId);
247 }
248
249 public static java.util.List findByG_S(long groupId,
250 java.lang.String structureId, int begin, int end)
251 throws com.liferay.portal.SystemException {
252 return getPersistence().findByG_S(groupId, structureId, begin, end);
253 }
254
255 public static java.util.List findByG_S(long groupId,
256 java.lang.String structureId, int begin, int end,
257 com.liferay.portal.kernel.util.OrderByComparator obc)
258 throws com.liferay.portal.SystemException {
259 return getPersistence().findByG_S(groupId, structureId, begin, end, obc);
260 }
261
262 public static com.liferay.portlet.journal.model.JournalTemplate findByG_S_First(
263 long groupId, java.lang.String structureId,
264 com.liferay.portal.kernel.util.OrderByComparator obc)
265 throws com.liferay.portal.SystemException,
266 com.liferay.portlet.journal.NoSuchTemplateException {
267 return getPersistence().findByG_S_First(groupId, structureId, obc);
268 }
269
270 public static com.liferay.portlet.journal.model.JournalTemplate findByG_S_Last(
271 long groupId, java.lang.String structureId,
272 com.liferay.portal.kernel.util.OrderByComparator obc)
273 throws com.liferay.portal.SystemException,
274 com.liferay.portlet.journal.NoSuchTemplateException {
275 return getPersistence().findByG_S_Last(groupId, structureId, obc);
276 }
277
278 public static com.liferay.portlet.journal.model.JournalTemplate[] findByG_S_PrevAndNext(
279 long id, long groupId, java.lang.String structureId,
280 com.liferay.portal.kernel.util.OrderByComparator obc)
281 throws com.liferay.portal.SystemException,
282 com.liferay.portlet.journal.NoSuchTemplateException {
283 return getPersistence().findByG_S_PrevAndNext(id, groupId, structureId,
284 obc);
285 }
286
287 public static java.util.List findWithDynamicQuery(
288 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
289 throws com.liferay.portal.SystemException {
290 return getPersistence().findWithDynamicQuery(queryInitializer);
291 }
292
293 public static java.util.List findWithDynamicQuery(
294 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
295 int begin, int end) throws com.liferay.portal.SystemException {
296 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
297 end);
298 }
299
300 public static java.util.List findAll()
301 throws com.liferay.portal.SystemException {
302 return getPersistence().findAll();
303 }
304
305 public static java.util.List findAll(int begin, int end)
306 throws com.liferay.portal.SystemException {
307 return getPersistence().findAll(begin, end);
308 }
309
310 public static java.util.List findAll(int begin, int end,
311 com.liferay.portal.kernel.util.OrderByComparator obc)
312 throws com.liferay.portal.SystemException {
313 return getPersistence().findAll(begin, end, obc);
314 }
315
316 public static void removeByGroupId(long groupId)
317 throws com.liferay.portal.SystemException {
318 getPersistence().removeByGroupId(groupId);
319 }
320
321 public static void removeByTemplateId(java.lang.String templateId)
322 throws com.liferay.portal.SystemException {
323 getPersistence().removeByTemplateId(templateId);
324 }
325
326 public static void removeByG_T(long groupId, java.lang.String templateId)
327 throws com.liferay.portal.SystemException,
328 com.liferay.portlet.journal.NoSuchTemplateException {
329 getPersistence().removeByG_T(groupId, templateId);
330 }
331
332 public static void removeByG_S(long groupId, java.lang.String structureId)
333 throws com.liferay.portal.SystemException {
334 getPersistence().removeByG_S(groupId, structureId);
335 }
336
337 public static void removeAll() throws com.liferay.portal.SystemException {
338 getPersistence().removeAll();
339 }
340
341 public static int countByGroupId(long groupId)
342 throws com.liferay.portal.SystemException {
343 return getPersistence().countByGroupId(groupId);
344 }
345
346 public static int countByTemplateId(java.lang.String templateId)
347 throws com.liferay.portal.SystemException {
348 return getPersistence().countByTemplateId(templateId);
349 }
350
351 public static int countByG_T(long groupId, java.lang.String templateId)
352 throws com.liferay.portal.SystemException {
353 return getPersistence().countByG_T(groupId, templateId);
354 }
355
356 public static int countByG_S(long groupId, java.lang.String structureId)
357 throws com.liferay.portal.SystemException {
358 return getPersistence().countByG_S(groupId, structureId);
359 }
360
361 public static int countAll() throws com.liferay.portal.SystemException {
362 return getPersistence().countAll();
363 }
364
365 public static JournalTemplatePersistence getPersistence() {
366 return _getUtil()._persistence;
367 }
368
369 public void setPersistence(JournalTemplatePersistence persistence) {
370 _persistence = persistence;
371 }
372
373 private static JournalTemplateUtil _getUtil() {
374 if (_util == null) {
375 _util = (JournalTemplateUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
376 }
377
378 return _util;
379 }
380
381 private static ModelListener _getListener() {
382 if (Validator.isNotNull(_LISTENER)) {
383 try {
384 return (ModelListener)Class.forName(_LISTENER).newInstance();
385 }
386 catch (Exception e) {
387 _log.error(e);
388 }
389 }
390
391 return null;
392 }
393
394 private static final String _UTIL = JournalTemplateUtil.class.getName();
395 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
396 "value.object.listener.com.liferay.portlet.journal.model.JournalTemplate"));
397 private static Log _log = LogFactory.getLog(JournalTemplateUtil.class);
398 private static JournalTemplateUtil _util;
399 private JournalTemplatePersistence _persistence;
400 }