1
22
23 package com.liferay.portal.verify;
24
25 import com.liferay.portal.kernel.log.Log;
26 import com.liferay.portal.kernel.log.LogFactoryUtil;
27 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
28 import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
29
30 import java.util.List;
31
32
38 public class VerifyDocumentLibrary extends VerifyProcess {
39
40 public void verify() throws VerifyException {
41 _log.info("Verifying");
42
43 try {
44 verifyDocumentLibrary();
45 }
46 catch (Exception e) {
47 throw new VerifyException(e);
48 }
49 }
50
51 protected void verifyDocumentLibrary() throws Exception {
52 List<DLFileEntry> fileEntries =
53 DLFileEntryLocalServiceUtil.getNoAssetFileEntries();
54
55 if (_log.isDebugEnabled()) {
56 _log.debug(
57 "Processing " + fileEntries.size() +
58 " file entries with no tags assets");
59 }
60
61 for (DLFileEntry fileEntry : fileEntries) {
62 try {
63 DLFileEntryLocalServiceUtil.updateTagsAsset(
64 fileEntry.getUserId(), fileEntry, new String[0]);
65 }
66 catch (Exception e) {
67 if (_log.isWarnEnabled()) {
68 _log.warn(
69 "Unable to update tags asset for file entry " +
70 fileEntry.getFileEntryId() + ": " + e.getMessage());
71 }
72 }
73 }
74
75 if (_log.isDebugEnabled()) {
76 _log.debug("Tags assets verified for file entries");
77 }
78 }
79
80 private static Log _log =
81 LogFactoryUtil.getLog(VerifyDocumentLibrary.class);
82
83 }