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 @Override
040 public void processAction(
041 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
042 ActionRequest actionRequest, ActionResponse actionResponse)
043 throws Exception {
044
045 String className = ParamUtil.getString(actionRequest, "className");
046 long classPK = ParamUtil.getLong(actionRequest, "classPK");
047 String reporterEmailAddress = ParamUtil.getString(
048 actionRequest, "reporterEmailAddress");
049 long reportedUserId = ParamUtil.getLong(
050 actionRequest, "reportedUserId");
051 String contentTitle = ParamUtil.getString(
052 actionRequest, "contentTitle");
053 String contentURL = ParamUtil.getString(actionRequest, "contentURL");
054 String reason = ParamUtil.getString(actionRequest, "reason");
055
056 ServiceContext serviceContext = ServiceContextFactory.getInstance(
057 "com.liferay.portlet.flags.model.FlagsEntry", actionRequest);
058
059 FlagsEntryServiceUtil.addEntry(
060 className, classPK, reporterEmailAddress, reportedUserId,
061 contentTitle, contentURL, reason, serviceContext);
062
063 setForward(actionRequest, ActionConstants.COMMON_NULL);
064 }
065
066 @Override
067 public ActionForward render(
068 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
069 RenderRequest renderRequest, RenderResponse renderResponse)
070 throws Exception {
071
072 return mapping.findForward(
073 getForward(renderRequest, "portlet.flags.edit_entry"));
074 }
075
076 }