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