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