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