1
22
23 package com.liferay.portal.verify;
24
25 import com.liferay.portlet.bookmarks.model.BookmarksEntry;
26 import com.liferay.portlet.bookmarks.service.BookmarksEntryLocalServiceUtil;
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 VerifyBookmarks extends VerifyProcess {
40
41 public void verify() throws VerifyException {
42 _log.info("Verifying");
43
44 try {
45 verifyBookmarks();
46 }
47 catch (Exception e) {
48 throw new VerifyException(e);
49 }
50 }
51
52 protected void verifyBookmarks() throws Exception {
53 List<BookmarksEntry> entries =
54 BookmarksEntryLocalServiceUtil.getNoAssetEntries();
55
56 if (_log.isDebugEnabled()) {
57 _log.debug(
58 "Processing " + entries.size() +
59 " entries with no tags assets");
60 }
61
62 for (BookmarksEntry entry : entries) {
63 try {
64 BookmarksEntryLocalServiceUtil.updateTagsAsset(
65 entry.getUserId(), entry, new String[0]);
66 }
67 catch (Exception e) {
68 if (_log.isWarnEnabled()) {
69 _log.warn(
70 "Unable to update tags asset for entry " +
71 entry.getEntryId() + ": " + e.getMessage());
72 }
73 }
74 }
75
76 if (_log.isDebugEnabled()) {
77 _log.debug("Tags assets verified for entries");
78 }
79 }
80
81 private static Log _log = LogFactory.getLog(VerifyBookmarks.class);
82
83 }