com.liferay.commerce.pricing.web.internal.portlet.action.EditAccountEntryDefaultCommerceDiscountMVCRenderCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.commerce.pricing.web
Show all versions of com.liferay.commerce.pricing.web
Liferay Commerce Pricing Web
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.commerce.pricing.web.internal.portlet.action;
import com.liferay.account.constants.AccountPortletKeys;
import com.liferay.account.model.AccountEntry;
import com.liferay.account.service.AccountEntryService;
import com.liferay.commerce.discount.service.CommerceDiscountService;
import com.liferay.commerce.price.list.service.CommercePriceListService;
import com.liferay.commerce.pricing.web.internal.display.context.CommerceChannelAccountEntryRelDisplayContext;
import com.liferay.commerce.product.service.CommerceChannelAccountEntryRelService;
import com.liferay.commerce.product.service.CommerceChannelService;
import com.liferay.portal.kernel.language.Language;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCRenderCommand;
import com.liferay.portal.kernel.portlet.bridges.mvc.constants.MVCRenderConstants;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermission;
import com.liferay.portal.kernel.util.Portal;
import com.liferay.portal.kernel.util.WebKeys;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.component.annotations.ReferencePolicyOption;
/**
* @author Alessio Antonio Rendina
*/
@Component(
property = {
"javax.portlet.name=" + AccountPortletKeys.ACCOUNT_ENTRIES_ADMIN,
"javax.portlet.name=" + AccountPortletKeys.ACCOUNT_ENTRIES_MANAGEMENT,
"mvc.command.name=/commerce_pricing/edit_account_entry_default_commerce_discount"
},
service = MVCRenderCommand.class
)
public class EditAccountEntryDefaultCommerceDiscountMVCRenderCommand
implements MVCRenderCommand {
@Override
public String render(
RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException {
RequestDispatcher requestDispatcher =
_servletContext.getRequestDispatcher(
"/dynamic_include/select_default_commerce_discount.jsp");
try {
HttpServletRequest httpServletRequest =
_portal.getHttpServletRequest(renderRequest);
CommerceChannelAccountEntryRelDisplayContext
commerceChannelAccountEntryRelDisplayContext =
new CommerceChannelAccountEntryRelDisplayContext(
_accountEntryModelResourcePermission,
_accountEntryService,
_commerceChannelAccountEntryRelService,
_commerceChannelService, _commerceDiscountService,
_commercePriceListService, httpServletRequest,
_language);
httpServletRequest.setAttribute(
WebKeys.PORTLET_DISPLAY_CONTEXT,
commerceChannelAccountEntryRelDisplayContext);
requestDispatcher.include(
httpServletRequest,
_portal.getHttpServletResponse(renderResponse));
}
catch (Exception exception) {
throw new PortletException(exception);
}
return MVCRenderConstants.MVC_PATH_VALUE_SKIP_DISPATCH;
}
@Reference(
policy = ReferencePolicy.DYNAMIC,
policyOption = ReferencePolicyOption.GREEDY,
target = "(model.class.name=com.liferay.account.model.AccountEntry)"
)
private volatile ModelResourcePermission
_accountEntryModelResourcePermission;
@Reference
private AccountEntryService _accountEntryService;
@Reference
private CommerceChannelAccountEntryRelService
_commerceChannelAccountEntryRelService;
@Reference
private CommerceChannelService _commerceChannelService;
@Reference
private CommerceDiscountService _commerceDiscountService;
@Reference
private CommercePriceListService _commercePriceListService;
@Reference
private Language _language;
@Reference
private Portal _portal;
@Reference(
target = "(osgi.web.symbolicname=com.liferay.commerce.pricing.web)"
)
private ServletContext _servletContext;
}