/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.portal.workflow.instance.web.internal.display.context; import com.liferay.portal.kernel.portlet.LiferayPortletRequest; import com.liferay.portal.kernel.portlet.LiferayPortletResponse; import com.liferay.portal.kernel.portlet.PortalPreferences; import com.liferay.portal.kernel.portlet.PortletPreferencesFactoryUtil; import com.liferay.portal.kernel.theme.ThemeDisplay; import com.liferay.portal.kernel.util.FastDateFormatFactoryUtil; import com.liferay.portal.kernel.util.PortalUtil; import com.liferay.portal.kernel.util.WebKeys; import com.liferay.portal.workflow.instance.web.internal.display.context.util.WorkflowInstanceRequestHelper; import java.text.Format; import javax.servlet.http.HttpServletRequest; /** * @author Marcellus Tavares */ public abstract class BaseWorkflowInstanceDisplayContext { public BaseWorkflowInstanceDisplayContext( LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse) { this.liferayPortletRequest = liferayPortletRequest; this.liferayPortletResponse = liferayPortletResponse; request = PortalUtil.getHttpServletRequest(liferayPortletRequest); portalPreferences = PortletPreferencesFactoryUtil.getPortalPreferences( request); ThemeDisplay themeDisplay = (ThemeDisplay)liferayPortletRequest.getAttribute( WebKeys.THEME_DISPLAY); dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime( themeDisplay.getLocale(), themeDisplay.getTimeZone()); workflowInstanceRequestHelper = new WorkflowInstanceRequestHelper( request); } protected final Format dateFormatDateTime; protected final LiferayPortletRequest liferayPortletRequest; protected final LiferayPortletResponse liferayPortletResponse; protected final PortalPreferences portalPreferences; protected final HttpServletRequest request; protected final WorkflowInstanceRequestHelper workflowInstanceRequestHelper; }