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 AddressUtil {
40 public static com.liferay.portal.model.Address create(long addressId) {
41 return getPersistence().create(addressId);
42 }
43
44 public static com.liferay.portal.model.Address remove(long addressId)
45 throws com.liferay.portal.SystemException,
46 com.liferay.portal.NoSuchAddressException {
47 ModelListener listener = _getListener();
48
49 if (listener != null) {
50 listener.onBeforeRemove(findByPrimaryKey(addressId));
51 }
52
53 com.liferay.portal.model.Address address = getPersistence().remove(addressId);
54
55 if (listener != null) {
56 listener.onAfterRemove(address);
57 }
58
59 return address;
60 }
61
62 public static com.liferay.portal.model.Address remove(
63 com.liferay.portal.model.Address address)
64 throws com.liferay.portal.SystemException {
65 ModelListener listener = _getListener();
66
67 if (listener != null) {
68 listener.onBeforeRemove(address);
69 }
70
71 address = getPersistence().remove(address);
72
73 if (listener != null) {
74 listener.onAfterRemove(address);
75 }
76
77 return address;
78 }
79
80 public static com.liferay.portal.model.Address update(
81 com.liferay.portal.model.Address address)
82 throws com.liferay.portal.SystemException {
83 ModelListener listener = _getListener();
84 boolean isNew = address.isNew();
85
86 if (listener != null) {
87 if (isNew) {
88 listener.onBeforeCreate(address);
89 }
90 else {
91 listener.onBeforeUpdate(address);
92 }
93 }
94
95 address = getPersistence().update(address);
96
97 if (listener != null) {
98 if (isNew) {
99 listener.onAfterCreate(address);
100 }
101 else {
102 listener.onAfterUpdate(address);
103 }
104 }
105
106 return address;
107 }
108
109 public static com.liferay.portal.model.Address update(
110 com.liferay.portal.model.Address address, boolean merge)
111 throws com.liferay.portal.SystemException {
112 ModelListener listener = _getListener();
113 boolean isNew = address.isNew();
114
115 if (listener != null) {
116 if (isNew) {
117 listener.onBeforeCreate(address);
118 }
119 else {
120 listener.onBeforeUpdate(address);
121 }
122 }
123
124 address = getPersistence().update(address, merge);
125
126 if (listener != null) {
127 if (isNew) {
128 listener.onAfterCreate(address);
129 }
130 else {
131 listener.onAfterUpdate(address);
132 }
133 }
134
135 return address;
136 }
137
138 public static com.liferay.portal.model.Address findByPrimaryKey(
139 long addressId)
140 throws com.liferay.portal.SystemException,
141 com.liferay.portal.NoSuchAddressException {
142 return getPersistence().findByPrimaryKey(addressId);
143 }
144
145 public static com.liferay.portal.model.Address fetchByPrimaryKey(
146 long addressId) throws com.liferay.portal.SystemException {
147 return getPersistence().fetchByPrimaryKey(addressId);
148 }
149
150 public static java.util.List findByCompanyId(long companyId)
151 throws com.liferay.portal.SystemException {
152 return getPersistence().findByCompanyId(companyId);
153 }
154
155 public static java.util.List findByCompanyId(long companyId, int begin,
156 int end) throws com.liferay.portal.SystemException {
157 return getPersistence().findByCompanyId(companyId, begin, end);
158 }
159
160 public static java.util.List findByCompanyId(long companyId, int begin,
161 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
162 throws com.liferay.portal.SystemException {
163 return getPersistence().findByCompanyId(companyId, begin, end, obc);
164 }
165
166 public static com.liferay.portal.model.Address findByCompanyId_First(
167 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
168 throws com.liferay.portal.SystemException,
169 com.liferay.portal.NoSuchAddressException {
170 return getPersistence().findByCompanyId_First(companyId, obc);
171 }
172
173 public static com.liferay.portal.model.Address findByCompanyId_Last(
174 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
175 throws com.liferay.portal.SystemException,
176 com.liferay.portal.NoSuchAddressException {
177 return getPersistence().findByCompanyId_Last(companyId, obc);
178 }
179
180 public static com.liferay.portal.model.Address[] findByCompanyId_PrevAndNext(
181 long addressId, long companyId,
182 com.liferay.portal.kernel.util.OrderByComparator obc)
183 throws com.liferay.portal.SystemException,
184 com.liferay.portal.NoSuchAddressException {
185 return getPersistence().findByCompanyId_PrevAndNext(addressId,
186 companyId, obc);
187 }
188
189 public static java.util.List findByUserId(long userId)
190 throws com.liferay.portal.SystemException {
191 return getPersistence().findByUserId(userId);
192 }
193
194 public static java.util.List findByUserId(long userId, int begin, int end)
195 throws com.liferay.portal.SystemException {
196 return getPersistence().findByUserId(userId, begin, end);
197 }
198
199 public static java.util.List findByUserId(long userId, int begin, int end,
200 com.liferay.portal.kernel.util.OrderByComparator obc)
201 throws com.liferay.portal.SystemException {
202 return getPersistence().findByUserId(userId, begin, end, obc);
203 }
204
205 public static com.liferay.portal.model.Address findByUserId_First(
206 long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
207 throws com.liferay.portal.SystemException,
208 com.liferay.portal.NoSuchAddressException {
209 return getPersistence().findByUserId_First(userId, obc);
210 }
211
212 public static com.liferay.portal.model.Address findByUserId_Last(
213 long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
214 throws com.liferay.portal.SystemException,
215 com.liferay.portal.NoSuchAddressException {
216 return getPersistence().findByUserId_Last(userId, obc);
217 }
218
219 public static com.liferay.portal.model.Address[] findByUserId_PrevAndNext(
220 long addressId, long userId,
221 com.liferay.portal.kernel.util.OrderByComparator obc)
222 throws com.liferay.portal.SystemException,
223 com.liferay.portal.NoSuchAddressException {
224 return getPersistence().findByUserId_PrevAndNext(addressId, userId, obc);
225 }
226
227 public static java.util.List findByC_C(long companyId, long classNameId)
228 throws com.liferay.portal.SystemException {
229 return getPersistence().findByC_C(companyId, classNameId);
230 }
231
232 public static java.util.List findByC_C(long companyId, long classNameId,
233 int begin, int end) throws com.liferay.portal.SystemException {
234 return getPersistence().findByC_C(companyId, classNameId, begin, end);
235 }
236
237 public static java.util.List findByC_C(long companyId, long classNameId,
238 int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
239 throws com.liferay.portal.SystemException {
240 return getPersistence().findByC_C(companyId, classNameId, begin, end,
241 obc);
242 }
243
244 public static com.liferay.portal.model.Address findByC_C_First(
245 long companyId, long classNameId,
246 com.liferay.portal.kernel.util.OrderByComparator obc)
247 throws com.liferay.portal.SystemException,
248 com.liferay.portal.NoSuchAddressException {
249 return getPersistence().findByC_C_First(companyId, classNameId, obc);
250 }
251
252 public static com.liferay.portal.model.Address findByC_C_Last(
253 long companyId, long classNameId,
254 com.liferay.portal.kernel.util.OrderByComparator obc)
255 throws com.liferay.portal.SystemException,
256 com.liferay.portal.NoSuchAddressException {
257 return getPersistence().findByC_C_Last(companyId, classNameId, obc);
258 }
259
260 public static com.liferay.portal.model.Address[] findByC_C_PrevAndNext(
261 long addressId, long companyId, long classNameId,
262 com.liferay.portal.kernel.util.OrderByComparator obc)
263 throws com.liferay.portal.SystemException,
264 com.liferay.portal.NoSuchAddressException {
265 return getPersistence().findByC_C_PrevAndNext(addressId, companyId,
266 classNameId, obc);
267 }
268
269 public static java.util.List findByC_C_C(long companyId, long classNameId,
270 long classPK) throws com.liferay.portal.SystemException {
271 return getPersistence().findByC_C_C(companyId, classNameId, classPK);
272 }
273
274 public static java.util.List findByC_C_C(long companyId, long classNameId,
275 long classPK, int begin, int end)
276 throws com.liferay.portal.SystemException {
277 return getPersistence().findByC_C_C(companyId, classNameId, classPK,
278 begin, end);
279 }
280
281 public static java.util.List findByC_C_C(long companyId, long classNameId,
282 long classPK, int begin, int end,
283 com.liferay.portal.kernel.util.OrderByComparator obc)
284 throws com.liferay.portal.SystemException {
285 return getPersistence().findByC_C_C(companyId, classNameId, classPK,
286 begin, end, obc);
287 }
288
289 public static com.liferay.portal.model.Address findByC_C_C_First(
290 long companyId, long classNameId, long classPK,
291 com.liferay.portal.kernel.util.OrderByComparator obc)
292 throws com.liferay.portal.SystemException,
293 com.liferay.portal.NoSuchAddressException {
294 return getPersistence().findByC_C_C_First(companyId, classNameId,
295 classPK, obc);
296 }
297
298 public static com.liferay.portal.model.Address findByC_C_C_Last(
299 long companyId, long classNameId, long classPK,
300 com.liferay.portal.kernel.util.OrderByComparator obc)
301 throws com.liferay.portal.SystemException,
302 com.liferay.portal.NoSuchAddressException {
303 return getPersistence().findByC_C_C_Last(companyId, classNameId,
304 classPK, obc);
305 }
306
307 public static com.liferay.portal.model.Address[] findByC_C_C_PrevAndNext(
308 long addressId, long companyId, long classNameId, long classPK,
309 com.liferay.portal.kernel.util.OrderByComparator obc)
310 throws com.liferay.portal.SystemException,
311 com.liferay.portal.NoSuchAddressException {
312 return getPersistence().findByC_C_C_PrevAndNext(addressId, companyId,
313 classNameId, classPK, obc);
314 }
315
316 public static java.util.List findByC_C_C_M(long companyId,
317 long classNameId, long classPK, boolean mailing)
318 throws com.liferay.portal.SystemException {
319 return getPersistence().findByC_C_C_M(companyId, classNameId, classPK,
320 mailing);
321 }
322
323 public static java.util.List findByC_C_C_M(long companyId,
324 long classNameId, long classPK, boolean mailing, int begin, int end)
325 throws com.liferay.portal.SystemException {
326 return getPersistence().findByC_C_C_M(companyId, classNameId, classPK,
327 mailing, begin, end);
328 }
329
330 public static java.util.List findByC_C_C_M(long companyId,
331 long classNameId, long classPK, boolean mailing, int begin, int end,
332 com.liferay.portal.kernel.util.OrderByComparator obc)
333 throws com.liferay.portal.SystemException {
334 return getPersistence().findByC_C_C_M(companyId, classNameId, classPK,
335 mailing, begin, end, obc);
336 }
337
338 public static com.liferay.portal.model.Address findByC_C_C_M_First(
339 long companyId, long classNameId, long classPK, boolean mailing,
340 com.liferay.portal.kernel.util.OrderByComparator obc)
341 throws com.liferay.portal.SystemException,
342 com.liferay.portal.NoSuchAddressException {
343 return getPersistence().findByC_C_C_M_First(companyId, classNameId,
344 classPK, mailing, obc);
345 }
346
347 public static com.liferay.portal.model.Address findByC_C_C_M_Last(
348 long companyId, long classNameId, long classPK, boolean mailing,
349 com.liferay.portal.kernel.util.OrderByComparator obc)
350 throws com.liferay.portal.SystemException,
351 com.liferay.portal.NoSuchAddressException {
352 return getPersistence().findByC_C_C_M_Last(companyId, classNameId,
353 classPK, mailing, obc);
354 }
355
356 public static com.liferay.portal.model.Address[] findByC_C_C_M_PrevAndNext(
357 long addressId, long companyId, long classNameId, long classPK,
358 boolean mailing, com.liferay.portal.kernel.util.OrderByComparator obc)
359 throws com.liferay.portal.SystemException,
360 com.liferay.portal.NoSuchAddressException {
361 return getPersistence().findByC_C_C_M_PrevAndNext(addressId, companyId,
362 classNameId, classPK, mailing, obc);
363 }
364
365 public static java.util.List findByC_C_C_P(long companyId,
366 long classNameId, long classPK, boolean primary)
367 throws com.liferay.portal.SystemException {
368 return getPersistence().findByC_C_C_P(companyId, classNameId, classPK,
369 primary);
370 }
371
372 public static java.util.List findByC_C_C_P(long companyId,
373 long classNameId, long classPK, boolean primary, int begin, int end)
374 throws com.liferay.portal.SystemException {
375 return getPersistence().findByC_C_C_P(companyId, classNameId, classPK,
376 primary, begin, end);
377 }
378
379 public static java.util.List findByC_C_C_P(long companyId,
380 long classNameId, long classPK, boolean primary, int begin, int end,
381 com.liferay.portal.kernel.util.OrderByComparator obc)
382 throws com.liferay.portal.SystemException {
383 return getPersistence().findByC_C_C_P(companyId, classNameId, classPK,
384 primary, begin, end, obc);
385 }
386
387 public static com.liferay.portal.model.Address findByC_C_C_P_First(
388 long companyId, long classNameId, long classPK, boolean primary,
389 com.liferay.portal.kernel.util.OrderByComparator obc)
390 throws com.liferay.portal.SystemException,
391 com.liferay.portal.NoSuchAddressException {
392 return getPersistence().findByC_C_C_P_First(companyId, classNameId,
393 classPK, primary, obc);
394 }
395
396 public static com.liferay.portal.model.Address findByC_C_C_P_Last(
397 long companyId, long classNameId, long classPK, boolean primary,
398 com.liferay.portal.kernel.util.OrderByComparator obc)
399 throws com.liferay.portal.SystemException,
400 com.liferay.portal.NoSuchAddressException {
401 return getPersistence().findByC_C_C_P_Last(companyId, classNameId,
402 classPK, primary, obc);
403 }
404
405 public static com.liferay.portal.model.Address[] findByC_C_C_P_PrevAndNext(
406 long addressId, long companyId, long classNameId, long classPK,
407 boolean primary, com.liferay.portal.kernel.util.OrderByComparator obc)
408 throws com.liferay.portal.SystemException,
409 com.liferay.portal.NoSuchAddressException {
410 return getPersistence().findByC_C_C_P_PrevAndNext(addressId, companyId,
411 classNameId, classPK, primary, obc);
412 }
413
414 public static java.util.List findWithDynamicQuery(
415 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
416 throws com.liferay.portal.SystemException {
417 return getPersistence().findWithDynamicQuery(queryInitializer);
418 }
419
420 public static java.util.List findWithDynamicQuery(
421 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
422 int begin, int end) throws com.liferay.portal.SystemException {
423 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
424 end);
425 }
426
427 public static java.util.List findAll()
428 throws com.liferay.portal.SystemException {
429 return getPersistence().findAll();
430 }
431
432 public static java.util.List findAll(int begin, int end)
433 throws com.liferay.portal.SystemException {
434 return getPersistence().findAll(begin, end);
435 }
436
437 public static java.util.List findAll(int begin, int end,
438 com.liferay.portal.kernel.util.OrderByComparator obc)
439 throws com.liferay.portal.SystemException {
440 return getPersistence().findAll(begin, end, obc);
441 }
442
443 public static void removeByCompanyId(long companyId)
444 throws com.liferay.portal.SystemException {
445 getPersistence().removeByCompanyId(companyId);
446 }
447
448 public static void removeByUserId(long userId)
449 throws com.liferay.portal.SystemException {
450 getPersistence().removeByUserId(userId);
451 }
452
453 public static void removeByC_C(long companyId, long classNameId)
454 throws com.liferay.portal.SystemException {
455 getPersistence().removeByC_C(companyId, classNameId);
456 }
457
458 public static void removeByC_C_C(long companyId, long classNameId,
459 long classPK) throws com.liferay.portal.SystemException {
460 getPersistence().removeByC_C_C(companyId, classNameId, classPK);
461 }
462
463 public static void removeByC_C_C_M(long companyId, long classNameId,
464 long classPK, boolean mailing)
465 throws com.liferay.portal.SystemException {
466 getPersistence().removeByC_C_C_M(companyId, classNameId, classPK,
467 mailing);
468 }
469
470 public static void removeByC_C_C_P(long companyId, long classNameId,
471 long classPK, boolean primary)
472 throws com.liferay.portal.SystemException {
473 getPersistence().removeByC_C_C_P(companyId, classNameId, classPK,
474 primary);
475 }
476
477 public static void removeAll() throws com.liferay.portal.SystemException {
478 getPersistence().removeAll();
479 }
480
481 public static int countByCompanyId(long companyId)
482 throws com.liferay.portal.SystemException {
483 return getPersistence().countByCompanyId(companyId);
484 }
485
486 public static int countByUserId(long userId)
487 throws com.liferay.portal.SystemException {
488 return getPersistence().countByUserId(userId);
489 }
490
491 public static int countByC_C(long companyId, long classNameId)
492 throws com.liferay.portal.SystemException {
493 return getPersistence().countByC_C(companyId, classNameId);
494 }
495
496 public static int countByC_C_C(long companyId, long classNameId,
497 long classPK) throws com.liferay.portal.SystemException {
498 return getPersistence().countByC_C_C(companyId, classNameId, classPK);
499 }
500
501 public static int countByC_C_C_M(long companyId, long classNameId,
502 long classPK, boolean mailing)
503 throws com.liferay.portal.SystemException {
504 return getPersistence().countByC_C_C_M(companyId, classNameId, classPK,
505 mailing);
506 }
507
508 public static int countByC_C_C_P(long companyId, long classNameId,
509 long classPK, boolean primary)
510 throws com.liferay.portal.SystemException {
511 return getPersistence().countByC_C_C_P(companyId, classNameId, classPK,
512 primary);
513 }
514
515 public static int countAll() throws com.liferay.portal.SystemException {
516 return getPersistence().countAll();
517 }
518
519 public static AddressPersistence getPersistence() {
520 return _getUtil()._persistence;
521 }
522
523 public void setPersistence(AddressPersistence persistence) {
524 _persistence = persistence;
525 }
526
527 private static AddressUtil _getUtil() {
528 if (_util == null) {
529 _util = (AddressUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
530 }
531
532 return _util;
533 }
534
535 private static ModelListener _getListener() {
536 if (Validator.isNotNull(_LISTENER)) {
537 try {
538 return (ModelListener)Class.forName(_LISTENER).newInstance();
539 }
540 catch (Exception e) {
541 _log.error(e);
542 }
543 }
544
545 return null;
546 }
547
548 private static final String _UTIL = AddressUtil.class.getName();
549 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
550 "value.object.listener.com.liferay.portal.model.Address"));
551 private static Log _log = LogFactory.getLog(AddressUtil.class);
552 private static AddressUtil _util;
553 private AddressPersistence _persistence;
554 }