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