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 JournalStructureUtil {
40 public static com.liferay.portlet.journal.model.JournalStructure create(
41 long id) {
42 return getPersistence().create(id);
43 }
44
45 public static com.liferay.portlet.journal.model.JournalStructure remove(
46 long id)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portlet.journal.NoSuchStructureException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(id));
53 }
54
55 com.liferay.portlet.journal.model.JournalStructure journalStructure = getPersistence()
56 .remove(id);
57
58 if (listener != null) {
59 listener.onAfterRemove(journalStructure);
60 }
61
62 return journalStructure;
63 }
64
65 public static com.liferay.portlet.journal.model.JournalStructure remove(
66 com.liferay.portlet.journal.model.JournalStructure journalStructure)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(journalStructure);
72 }
73
74 journalStructure = getPersistence().remove(journalStructure);
75
76 if (listener != null) {
77 listener.onAfterRemove(journalStructure);
78 }
79
80 return journalStructure;
81 }
82
83 public static com.liferay.portlet.journal.model.JournalStructure update(
84 com.liferay.portlet.journal.model.JournalStructure journalStructure)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = journalStructure.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(journalStructure);
92 }
93 else {
94 listener.onBeforeUpdate(journalStructure);
95 }
96 }
97
98 journalStructure = getPersistence().update(journalStructure);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(journalStructure);
103 }
104 else {
105 listener.onAfterUpdate(journalStructure);
106 }
107 }
108
109 return journalStructure;
110 }
111
112 public static com.liferay.portlet.journal.model.JournalStructure update(
113 com.liferay.portlet.journal.model.JournalStructure journalStructure,
114 boolean merge) throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = journalStructure.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(journalStructure);
121 }
122 else {
123 listener.onBeforeUpdate(journalStructure);
124 }
125 }
126
127 journalStructure = getPersistence().update(journalStructure, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(journalStructure);
132 }
133 else {
134 listener.onAfterUpdate(journalStructure);
135 }
136 }
137
138 return journalStructure;
139 }
140
141 public static com.liferay.portlet.journal.model.JournalStructure findByPrimaryKey(
142 long id)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portlet.journal.NoSuchStructureException {
145 return getPersistence().findByPrimaryKey(id);
146 }
147
148 public static com.liferay.portlet.journal.model.JournalStructure 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.JournalStructure findByGroupId_First(
170 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
171 throws com.liferay.portal.SystemException,
172 com.liferay.portlet.journal.NoSuchStructureException {
173 return getPersistence().findByGroupId_First(groupId, obc);
174 }
175
176 public static com.liferay.portlet.journal.model.JournalStructure findByGroupId_Last(
177 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
178 throws com.liferay.portal.SystemException,
179 com.liferay.portlet.journal.NoSuchStructureException {
180 return getPersistence().findByGroupId_Last(groupId, obc);
181 }
182
183 public static com.liferay.portlet.journal.model.JournalStructure[] 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.NoSuchStructureException {
188 return getPersistence().findByGroupId_PrevAndNext(id, groupId, obc);
189 }
190
191 public static java.util.List findByStructureId(java.lang.String structureId)
192 throws com.liferay.portal.SystemException {
193 return getPersistence().findByStructureId(structureId);
194 }
195
196 public static java.util.List findByStructureId(
197 java.lang.String structureId, int begin, int end)
198 throws com.liferay.portal.SystemException {
199 return getPersistence().findByStructureId(structureId, begin, end);
200 }
201
202 public static java.util.List findByStructureId(
203 java.lang.String structureId, int begin, int end,
204 com.liferay.portal.kernel.util.OrderByComparator obc)
205 throws com.liferay.portal.SystemException {
206 return getPersistence().findByStructureId(structureId, begin, end, obc);
207 }
208
209 public static com.liferay.portlet.journal.model.JournalStructure findByStructureId_First(
210 java.lang.String structureId,
211 com.liferay.portal.kernel.util.OrderByComparator obc)
212 throws com.liferay.portal.SystemException,
213 com.liferay.portlet.journal.NoSuchStructureException {
214 return getPersistence().findByStructureId_First(structureId, obc);
215 }
216
217 public static com.liferay.portlet.journal.model.JournalStructure findByStructureId_Last(
218 java.lang.String structureId,
219 com.liferay.portal.kernel.util.OrderByComparator obc)
220 throws com.liferay.portal.SystemException,
221 com.liferay.portlet.journal.NoSuchStructureException {
222 return getPersistence().findByStructureId_Last(structureId, obc);
223 }
224
225 public static com.liferay.portlet.journal.model.JournalStructure[] findByStructureId_PrevAndNext(
226 long id, java.lang.String structureId,
227 com.liferay.portal.kernel.util.OrderByComparator obc)
228 throws com.liferay.portal.SystemException,
229 com.liferay.portlet.journal.NoSuchStructureException {
230 return getPersistence().findByStructureId_PrevAndNext(id, structureId,
231 obc);
232 }
233
234 public static com.liferay.portlet.journal.model.JournalStructure findByG_S(
235 long groupId, java.lang.String structureId)
236 throws com.liferay.portal.SystemException,
237 com.liferay.portlet.journal.NoSuchStructureException {
238 return getPersistence().findByG_S(groupId, structureId);
239 }
240
241 public static com.liferay.portlet.journal.model.JournalStructure fetchByG_S(
242 long groupId, java.lang.String structureId)
243 throws com.liferay.portal.SystemException {
244 return getPersistence().fetchByG_S(groupId, structureId);
245 }
246
247 public static java.util.List findWithDynamicQuery(
248 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
249 throws com.liferay.portal.SystemException {
250 return getPersistence().findWithDynamicQuery(queryInitializer);
251 }
252
253 public static java.util.List findWithDynamicQuery(
254 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
255 int begin, int end) throws com.liferay.portal.SystemException {
256 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
257 end);
258 }
259
260 public static java.util.List findAll()
261 throws com.liferay.portal.SystemException {
262 return getPersistence().findAll();
263 }
264
265 public static java.util.List findAll(int begin, int end)
266 throws com.liferay.portal.SystemException {
267 return getPersistence().findAll(begin, end);
268 }
269
270 public static java.util.List findAll(int begin, int end,
271 com.liferay.portal.kernel.util.OrderByComparator obc)
272 throws com.liferay.portal.SystemException {
273 return getPersistence().findAll(begin, end, obc);
274 }
275
276 public static void removeByGroupId(long groupId)
277 throws com.liferay.portal.SystemException {
278 getPersistence().removeByGroupId(groupId);
279 }
280
281 public static void removeByStructureId(java.lang.String structureId)
282 throws com.liferay.portal.SystemException {
283 getPersistence().removeByStructureId(structureId);
284 }
285
286 public static void removeByG_S(long groupId, java.lang.String structureId)
287 throws com.liferay.portal.SystemException,
288 com.liferay.portlet.journal.NoSuchStructureException {
289 getPersistence().removeByG_S(groupId, structureId);
290 }
291
292 public static void removeAll() throws com.liferay.portal.SystemException {
293 getPersistence().removeAll();
294 }
295
296 public static int countByGroupId(long groupId)
297 throws com.liferay.portal.SystemException {
298 return getPersistence().countByGroupId(groupId);
299 }
300
301 public static int countByStructureId(java.lang.String structureId)
302 throws com.liferay.portal.SystemException {
303 return getPersistence().countByStructureId(structureId);
304 }
305
306 public static int countByG_S(long groupId, java.lang.String structureId)
307 throws com.liferay.portal.SystemException {
308 return getPersistence().countByG_S(groupId, structureId);
309 }
310
311 public static int countAll() throws com.liferay.portal.SystemException {
312 return getPersistence().countAll();
313 }
314
315 public static JournalStructurePersistence getPersistence() {
316 return _getUtil()._persistence;
317 }
318
319 public void setPersistence(JournalStructurePersistence persistence) {
320 _persistence = persistence;
321 }
322
323 private static JournalStructureUtil _getUtil() {
324 if (_util == null) {
325 _util = (JournalStructureUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
326 }
327
328 return _util;
329 }
330
331 private static ModelListener _getListener() {
332 if (Validator.isNotNull(_LISTENER)) {
333 try {
334 return (ModelListener)Class.forName(_LISTENER).newInstance();
335 }
336 catch (Exception e) {
337 _log.error(e);
338 }
339 }
340
341 return null;
342 }
343
344 private static final String _UTIL = JournalStructureUtil.class.getName();
345 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
346 "value.object.listener.com.liferay.portlet.journal.model.JournalStructure"));
347 private static Log _log = LogFactory.getLog(JournalStructureUtil.class);
348 private static JournalStructureUtil _util;
349 private JournalStructurePersistence _persistence;
350 }