1
22
23 package com.liferay.portlet.flags.action;
24
25 import com.liferay.portal.kernel.util.ParamUtil;
26 import com.liferay.portal.service.ServiceContext;
27 import com.liferay.portal.service.ServiceContextFactory;
28 import com.liferay.portal.struts.ActionConstants;
29 import com.liferay.portal.struts.PortletAction;
30 import com.liferay.portlet.flags.service.FlagsEntryServiceUtil;
31
32 import javax.portlet.ActionRequest;
33 import javax.portlet.ActionResponse;
34 import javax.portlet.PortletConfig;
35 import javax.portlet.RenderRequest;
36 import javax.portlet.RenderResponse;
37
38 import org.apache.struts.action.ActionForm;
39 import org.apache.struts.action.ActionForward;
40 import org.apache.struts.action.ActionMapping;
41
42
48 public class EditEntryAction extends PortletAction {
49
50 public void processAction(
51 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
52 ActionRequest actionRequest, ActionResponse actionResponse)
53 throws Exception {
54
55 String className = ParamUtil.getString(actionRequest, "className");
56 long classPK = ParamUtil.getLong(actionRequest, "classPK");
57 String reporterEmailAddress = ParamUtil.getString(
58 actionRequest, "reporterEmailAddress");
59 long reportedUserId = ParamUtil.getLong(
60 actionRequest, "reportedUserId");
61 String contentTitle = ParamUtil.getString(
62 actionRequest, "contentTitle");
63 String contentURL = ParamUtil.getString(actionRequest, "contentURL");
64 String reason = ParamUtil.getString(actionRequest, "reason");
65
66 ServiceContext serviceContext = ServiceContextFactory.getInstance(
67 "com.liferay.portlet.flags.model.FlagsEntry", actionRequest);
68
69 FlagsEntryServiceUtil.addEntry(
70 className, classPK, reporterEmailAddress, reportedUserId,
71 contentTitle, contentURL, reason, serviceContext);
72
73 setForward(actionRequest, ActionConstants.COMMON_NULL);
74 }
75
76 public ActionForward render(
77 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
78 RenderRequest renderRequest, RenderResponse renderResponse)
79 throws Exception {
80
81 return mapping.findForward(
82 getForward(renderRequest, "portlet.flags.edit_entry"));
83 }
84
85 }