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 integrity");
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 fileEntries = 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 (int i = 0; i < fileEntries.size(); i++) {
62 DLFileEntry fileEntry = (DLFileEntry)fileEntries.get(i);
63
64 try {
65 DLFileEntryLocalServiceUtil.updateTagsAsset(
66 fileEntry.getUserId(), fileEntry, new String[0]);
67 }
68 catch (Exception e) {
69 if (_log.isWarnEnabled()) {
70 _log.warn(
71 "Unable to update tags asset for file entry " +
72 fileEntry.getFileEntryId(),
73 e);
74 }
75 }
76 }
77
78 if (_log.isDebugEnabled()) {
79 _log.debug("Tags assets verified for file entries");
80 }
81 }
82
83 private static Log _log = LogFactory.getLog(VerifyDocumentLibrary.class);
84
85 }