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