001
014
015 package com.liferay.portlet.blogs.model.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.Validator;
020 import com.liferay.portal.model.Image;
021 import com.liferay.portal.service.ImageLocalServiceUtil;
022 import com.liferay.portal.theme.ThemeDisplay;
023 import com.liferay.portal.webserver.WebServerServletTokenUtil;
024
025 import java.util.Date;
026
027
031 public class BlogsEntryImpl extends BlogsEntryBaseImpl {
032
033 public BlogsEntryImpl() {
034 }
035
036 public String getEntryImageURL(ThemeDisplay themeDisplay) {
037 if (!isSmallImage()) {
038 return null;
039 }
040
041 if (Validator.isNotNull(getSmallImageURL())) {
042 return getSmallImageURL();
043 }
044
045 return
046 themeDisplay.getPathImage() + "/blogs/entry?img_id=" +
047 getSmallImageId() + "&t=" +
048 WebServerServletTokenUtil.getToken(getSmallImageId());
049 }
050
051 public String getSmallImageType() throws PortalException, SystemException {
052 if ((_smallImageType == null) && isSmallImage()) {
053 Image smallImage = ImageLocalServiceUtil.getImage(
054 getSmallImageId());
055
056 _smallImageType = smallImage.getType();
057 }
058
059 return _smallImageType;
060 }
061
062 public boolean isVisible() {
063 Date displayDate = getDisplayDate();
064
065 if (isApproved() && displayDate.before(new Date())) {
066 return true;
067 }
068 else {
069 return false;
070 }
071 }
072
073 public void setSmallImageType(String smallImageType) {
074 _smallImageType = smallImageType;
075 }
076
077 private String _smallImageType;
078
079 }