com.liferay.commerce.tax.engine.fixed.service.impl.CommerceTaxFixedRateAddressRelServiceImpl Maven / Gradle / Ivy
/**
* 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.commerce.tax.engine.fixed.service.impl;
import com.liferay.commerce.constants.CommerceActionKeys;
import com.liferay.commerce.constants.CommerceConstants;
import com.liferay.commerce.tax.engine.fixed.model.CommerceTaxFixedRateAddressRel;
import com.liferay.commerce.tax.engine.fixed.service.base.CommerceTaxFixedRateAddressRelServiceBaseImpl;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.security.permission.resource.PortletResourcePermission;
import com.liferay.portal.kernel.security.permission.resource.PortletResourcePermissionFactory;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.util.OrderByComparator;
import java.util.List;
/**
* @author Marco Leo
* @author Alessio Antonio Rendina
*/
public class CommerceTaxFixedRateAddressRelServiceImpl
extends CommerceTaxFixedRateAddressRelServiceBaseImpl {
@Override
public CommerceTaxFixedRateAddressRel addCommerceTaxFixedRateAddressRel(
long commerceTaxMethodId, long cpTaxCategoryId,
long commerceCountryId, long commerceRegionId, String zip,
double rate, ServiceContext serviceContext)
throws PortalException {
_portletResourcePermission.check(
getPermissionChecker(), serviceContext.getScopeGroupId(),
CommerceActionKeys.MANAGE_COMMERCE_TAX_METHODS);
return commerceTaxFixedRateAddressRelLocalService.
addCommerceTaxFixedRateAddressRel(
commerceTaxMethodId, cpTaxCategoryId, commerceCountryId,
commerceRegionId, zip, rate, serviceContext);
}
@Override
public void deleteCommerceTaxFixedRateAddressRel(
long commerceTaxFixedRateAddressRelId)
throws PortalException {
CommerceTaxFixedRateAddressRel commerceTaxFixedRateAddressRel =
commerceTaxFixedRateAddressRelLocalService.
getCommerceTaxFixedRateAddressRel(
commerceTaxFixedRateAddressRelId);
_portletResourcePermission.check(
getPermissionChecker(), commerceTaxFixedRateAddressRel.getGroupId(),
CommerceActionKeys.MANAGE_COMMERCE_TAX_METHODS);
commerceTaxFixedRateAddressRelLocalService.
deleteCommerceTaxFixedRateAddressRel(
commerceTaxFixedRateAddressRel);
}
@Override
public CommerceTaxFixedRateAddressRel fetchCommerceTaxFixedRateAddressRel(
long commerceTaxFixedRateAddressRelId)
throws PortalException {
CommerceTaxFixedRateAddressRel commerceTaxFixedRateAddressRel =
commerceTaxFixedRateAddressRelLocalService.
fetchCommerceTaxFixedRateAddressRel(
commerceTaxFixedRateAddressRelId);
if (commerceTaxFixedRateAddressRel != null) {
_portletResourcePermission.check(
getPermissionChecker(),
commerceTaxFixedRateAddressRel.getGroupId(),
CommerceActionKeys.MANAGE_COMMERCE_TAX_METHODS);
}
return commerceTaxFixedRateAddressRel;
}
@Override
public List
getCommerceTaxMethodFixedRateAddressRels(
long groupId, long commerceTaxMethodId, int start, int end,
OrderByComparator
orderByComparator)
throws PortalException {
_portletResourcePermission.check(
getPermissionChecker(), groupId,
CommerceActionKeys.MANAGE_COMMERCE_TAX_METHODS);
return commerceTaxFixedRateAddressRelLocalService.
getCommerceTaxMethodFixedRateAddressRels(
commerceTaxMethodId, start, end, orderByComparator);
}
@Override
public int getCommerceTaxMethodFixedRateAddressRelsCount(
long groupId, long commerceTaxMethodId)
throws PortalException {
_portletResourcePermission.check(
getPermissionChecker(), groupId,
CommerceActionKeys.MANAGE_COMMERCE_TAX_METHODS);
return commerceTaxFixedRateAddressRelLocalService.
getCommerceTaxMethodFixedRateAddressRelsCount(commerceTaxMethodId);
}
@Override
public CommerceTaxFixedRateAddressRel updateCommerceTaxFixedRateAddressRel(
long commerceTaxFixedRateAddressRelId, long commerceCountryId,
long commerceRegionId, String zip, double rate)
throws PortalException {
CommerceTaxFixedRateAddressRel commerceTaxFixedRateAddressRel =
commerceTaxFixedRateAddressRelLocalService.
getCommerceTaxFixedRateAddressRel(
commerceTaxFixedRateAddressRelId);
_portletResourcePermission.check(
getPermissionChecker(), commerceTaxFixedRateAddressRel.getGroupId(),
CommerceActionKeys.MANAGE_COMMERCE_TAX_METHODS);
return commerceTaxFixedRateAddressRelLocalService.
updateCommerceTaxFixedRateAddressRel(
commerceTaxFixedRateAddressRelId, commerceCountryId,
commerceRegionId, zip, rate);
}
private static volatile PortletResourcePermission
_portletResourcePermission =
PortletResourcePermissionFactory.getInstance(
CommerceTaxFixedRateAddressRelServiceImpl.class,
"_portletResourcePermission", CommerceConstants.RESOURCE_NAME);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy