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