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