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