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