| VerifyDocumentLibrary.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portal.verify;
16
17 import com.liferay.portal.kernel.log.Log;
18 import com.liferay.portal.kernel.log.LogFactoryUtil;
19 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
20 import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
21
22 import java.util.List;
23
24 /**
25 * <a href="VerifyDocumentLibrary.java.html"><b><i>View Source</i></b></a>
26 *
27 * @author Raymond Augé
28 */
29 public class VerifyDocumentLibrary extends VerifyProcess {
30
31 protected void doVerify() throws Exception {
32 List<DLFileEntry> fileEntries =
33 DLFileEntryLocalServiceUtil.getNoAssetFileEntries();
34
35 if (_log.isDebugEnabled()) {
36 _log.debug(
37 "Processing " + fileEntries.size() +
38 " file entries with no asset");
39 }
40
41 for (DLFileEntry fileEntry : fileEntries) {
42 try {
43 DLFileEntryLocalServiceUtil.updateAsset(
44 fileEntry.getUserId(), fileEntry, null, null);
45 }
46 catch (Exception e) {
47 if (_log.isWarnEnabled()) {
48 _log.warn(
49 "Unable to update asset for file entry " +
50 fileEntry.getFileEntryId() + ": " + e.getMessage());
51 }
52 }
53 }
54
55 if (_log.isDebugEnabled()) {
56 _log.debug("Assets verified for file entries");
57 }
58 }
59
60 private static Log _log = LogFactoryUtil.getLog(
61 VerifyDocumentLibrary.class);
62
63 }