001
014
015 package com.liferay.portlet.documentlibrary.display.context.util;
016
017 import com.liferay.portal.kernel.display.context.util.BaseRequestHelper;
018 import com.liferay.portal.kernel.exception.PortalException;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.util.PortletKeys;
021 import com.liferay.portlet.documentlibrary.DLGroupServiceSettings;
022 import com.liferay.portlet.documentlibrary.DLPortletInstanceSettings;
023
024 import javax.servlet.http.HttpServletRequest;
025
026
029 public class DLRequestHelper extends BaseRequestHelper {
030
031 public DLRequestHelper(HttpServletRequest request) {
032 super(request);
033 }
034
035 public DLGroupServiceSettings getDLGroupServiceSettings() {
036 try {
037 if (_dlGroupServiceSettings == null) {
038 String portletId = getPortletId();
039
040 if (portletId.equals(PortletKeys.PORTLET_CONFIGURATION)) {
041 HttpServletRequest request = getRequest();
042
043 _dlGroupServiceSettings =
044 DLGroupServiceSettings.getInstance(
045 getScopeGroupId(), request.getParameterMap());
046 }
047 else {
048 _dlGroupServiceSettings =
049 DLGroupServiceSettings.getInstance(getScopeGroupId());
050 }
051 }
052
053 return _dlGroupServiceSettings;
054 }
055 catch (PortalException pe) {
056 throw new SystemException(pe);
057 }
058 }
059
060 public DLPortletInstanceSettings getDLPortletInstanceSettings() {
061 try {
062 if (_dlPortletInstanceSettings == null) {
063 String portletId = getPortletId();
064
065 if (portletId.equals(PortletKeys.PORTLET_CONFIGURATION)) {
066 HttpServletRequest request = getRequest();
067
068 _dlPortletInstanceSettings =
069 DLPortletInstanceSettings.getInstance(
070 getLayout(), getResourcePortletId(),
071 request.getParameterMap());
072 }
073 else {
074 _dlPortletInstanceSettings =
075 DLPortletInstanceSettings.getInstance(
076 getLayout(), getPortletId());
077 }
078 }
079
080 return _dlPortletInstanceSettings;
081 }
082 catch (PortalException pe) {
083 throw new SystemException(pe);
084 }
085 }
086
087 private DLGroupServiceSettings _dlGroupServiceSettings;
088 private DLPortletInstanceSettings _dlPortletInstanceSettings;
089
090 }