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