001
014
015 package com.liferay.portlet.flags.action;
016
017 import com.liferay.portal.kernel.util.ParamUtil;
018 import com.liferay.portal.service.ServiceContext;
019 import com.liferay.portal.service.ServiceContextFactory;
020 import com.liferay.portal.struts.ActionConstants;
021 import com.liferay.portal.struts.PortletAction;
022 import com.liferay.portlet.flags.service.FlagsEntryServiceUtil;
023
024 import javax.portlet.ActionRequest;
025 import javax.portlet.ActionResponse;
026 import javax.portlet.PortletConfig;
027 import javax.portlet.RenderRequest;
028 import javax.portlet.RenderResponse;
029
030 import org.apache.struts.action.ActionForm;
031 import org.apache.struts.action.ActionForward;
032 import org.apache.struts.action.ActionMapping;
033
034
037 public class EditEntryAction extends PortletAction {
038
039 public void processAction(
040 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
041 ActionRequest actionRequest, ActionResponse actionResponse)
042 throws Exception {
043
044 String className = ParamUtil.getString(actionRequest, "className");
045 long classPK = ParamUtil.getLong(actionRequest, "classPK");
046 String reporterEmailAddress = ParamUtil.getString(
047 actionRequest, "reporterEmailAddress");
048 long reportedUserId = ParamUtil.getLong(
049 actionRequest, "reportedUserId");
050 String contentTitle = ParamUtil.getString(
051 actionRequest, "contentTitle");
052 String contentURL = ParamUtil.getString(actionRequest, "contentURL");
053 String reason = ParamUtil.getString(actionRequest, "reason");
054
055 ServiceContext serviceContext = ServiceContextFactory.getInstance(
056 "com.liferay.portlet.flags.model.FlagsEntry", actionRequest);
057
058 FlagsEntryServiceUtil.addEntry(
059 className, classPK, reporterEmailAddress, reportedUserId,
060 contentTitle, contentURL, reason, serviceContext);
061
062 setForward(actionRequest, ActionConstants.COMMON_NULL);
063 }
064
065 public ActionForward render(
066 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
067 RenderRequest renderRequest, RenderResponse renderResponse)
068 throws Exception {
069
070 return mapping.findForward(
071 getForward(renderRequest, "portlet.flags.edit_entry"));
072 }
073
074 }