001
014
015 package com.liferay.portlet.dynamicdatalists.action;
016
017 import com.liferay.portal.kernel.util.ParamUtil;
018 import com.liferay.portal.kernel.util.Validator;
019 import com.liferay.portal.util.PortalUtil;
020 import com.liferay.portal.util.WebKeys;
021 import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
022 import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet;
023 import com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalServiceUtil;
024 import com.liferay.portlet.dynamicdatalists.service.DDLRecordSetLocalServiceUtil;
025
026 import javax.portlet.PortletRequest;
027
028 import javax.servlet.http.HttpServletRequest;
029
030
035 public class ActionUtil {
036
037 public static void getRecord(HttpServletRequest request) throws Exception {
038 long recordId = ParamUtil.getLong(request, "recordId");
039
040 DDLRecord record = null;
041
042 if (recordId > 0) {
043 record = DDLRecordLocalServiceUtil.getRecord(recordId);
044 }
045
046 request.setAttribute(WebKeys.DYNAMIC_DATA_LISTS_RECORD, record);
047 }
048
049 public static void getRecord(PortletRequest portletRequest)
050 throws Exception {
051
052 HttpServletRequest request = PortalUtil.getHttpServletRequest(
053 portletRequest);
054
055 getRecord(request);
056 }
057
058 public static void getRecordSet(HttpServletRequest request)
059 throws Exception {
060
061 long recordSetId = ParamUtil.getLong(request, "recordSetId");
062
063 DDLRecordSet recordSet = null;
064
065 if (Validator.isNotNull(recordSetId)) {
066 recordSet = DDLRecordSetLocalServiceUtil.getRecordSet(recordSetId);
067 }
068
069 request.setAttribute(WebKeys.DYNAMIC_DATA_LISTS_RECORD_SET, recordSet);
070 }
071
072 public static void getRecordSet(PortletRequest portletRequest)
073 throws Exception {
074
075 HttpServletRequest request = PortalUtil.getHttpServletRequest(
076 portletRequest);
077
078 getRecordSet(request);
079 }
080
081 }