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