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