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