001
014
015 package com.liferay.portlet.blogs.action;
016
017 import com.liferay.portal.kernel.util.ParamUtil;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.struts.FindAction;
020 import com.liferay.portal.util.PortletKeys;
021 import com.liferay.portlet.blogs.model.BlogsEntry;
022 import com.liferay.portlet.blogs.service.BlogsEntryLocalServiceUtil;
023
024 import javax.servlet.http.HttpServletRequest;
025
026
029 public class FindEntryAction extends FindAction {
030
031 @Override
032 protected long getGroupId(long primaryKey) throws Exception {
033 BlogsEntry entry = BlogsEntryLocalServiceUtil.getEntry(primaryKey);
034
035 return entry.getGroupId();
036 }
037
038 @Override
039 protected String getPrimaryKeyParameterName() {
040 return "entryId";
041 }
042
043 @Override
044 protected String getStrutsAction(
045 HttpServletRequest request, String portletId) {
046
047 String strutsAction = StringPool.BLANK;
048
049 if (portletId.equals(PortletKeys.BLOGS)) {
050 strutsAction = "/blogs";
051 }
052 else {
053 strutsAction = "/blogs_aggregator";
054 }
055
056 boolean showAllEntries = ParamUtil.getBoolean(
057 request, "showAllEntries");
058
059 if (showAllEntries) {
060 strutsAction += "/view";
061 }
062 else {
063 strutsAction += "/view_entry";
064 }
065
066 return strutsAction;
067 }
068
069 @Override
070 protected String[] initPortletIds() {
071 return new String[] {PortletKeys.BLOGS, PortletKeys.BLOGS_AGGREGATOR};
072 }
073
074 }