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