001
014
015 package com.liferay.portal.kernel.search;
016
017 import com.liferay.portal.kernel.util.StringUtil;
018
019 import java.util.Locale;
020
021 import javax.portlet.PortletURL;
022
023
027 public class Summary {
028
029 public Summary(
030 Locale locale, String title, String content, PortletURL portletURL) {
031
032 _title = title;
033 _content = content;
034 _locale = locale;
035 _portletURL = portletURL;
036 }
037
038 public Summary(String title, String content, PortletURL portletURL) {
039 _title = title;
040 _content = content;
041 _portletURL = portletURL;
042 }
043
044 public String getContent() {
045 return _content;
046 }
047
048 public Locale getLocale() {
049 return _locale;
050 }
051
052 public int getMaxContentLength() {
053 return _maxContentLength;
054 }
055
056 public PortletURL getPortletURL() {
057 return _portletURL;
058 }
059
060 public String getTitle() {
061 return _title;
062 }
063
064 public void setContent(String content) {
065 _content = content;
066
067 if ((_content != null) && (_maxContentLength > 0) &&
068 (_content.length() > _maxContentLength)) {
069
070 _content = StringUtil.shorten(_content, _maxContentLength);
071 }
072 }
073
074 public void setLocale(Locale locale) {
075 _locale = locale;
076 }
077
078 public void setMaxContentLength(int maxContentLength) {
079 _maxContentLength = maxContentLength;
080
081 setContent(_content);
082 }
083
084 public void setPortletURL(PortletURL portletURL) {
085 _portletURL = portletURL;
086 }
087
088 public void setTitle(String title) {
089 _title = title;
090 }
091
092 private String _content;
093 private Locale _locale;
094 private int _maxContentLength;
095 private PortletURL _portletURL;
096 private String _title;
097
098 }