com.liferay.commerce.discount.service.impl.CommerceDiscountAccountRelServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.commerce.discount.service
Show all versions of com.liferay.commerce.discount.service
Liferay Commerce Discount Service
/**
* 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.discount.service.impl;
import com.liferay.commerce.discount.model.CommerceDiscount;
import com.liferay.commerce.discount.model.CommerceDiscountAccountRel;
import com.liferay.commerce.discount.service.base.CommerceDiscountAccountRelServiceBaseImpl;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.security.permission.ActionKeys;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermission;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermissionFactory;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.util.OrderByComparator;
import java.util.List;
/**
* @author Riccardo Alberti
* @see CommerceDiscountAccountRelServiceBaseImpl
*/
public class CommerceDiscountAccountRelServiceImpl
extends CommerceDiscountAccountRelServiceBaseImpl {
@Override
public CommerceDiscountAccountRel addCommerceDiscountAccountRel(
long commerceDiscountId, long commerceAccountId,
ServiceContext serviceContext)
throws PortalException {
_commerceDiscountResourcePermission.check(
getPermissionChecker(), commerceDiscountId, ActionKeys.UPDATE);
return commerceDiscountAccountRelLocalService.
addCommerceDiscountAccountRel(
commerceDiscountId, commerceAccountId, serviceContext);
}
@Override
public void deleteCommerceDiscountAccountRel(
long commerceDiscountAccountRelId)
throws PortalException {
CommerceDiscountAccountRel commerceDiscountAccountRel =
commerceDiscountAccountRelLocalService.
getCommerceDiscountAccountRel(commerceDiscountAccountRelId);
_commerceDiscountResourcePermission.check(
getPermissionChecker(),
commerceDiscountAccountRel.getCommerceDiscountId(),
ActionKeys.UPDATE);
commerceDiscountAccountRelLocalService.deleteCommerceDiscountAccountRel(
commerceDiscountAccountRel);
}
@Override
public void deleteCommerceDiscountAccountRelsByCommerceDiscountId(
long commerceDiscountId)
throws PortalException {
_commerceDiscountResourcePermission.check(
getPermissionChecker(), commerceDiscountId, ActionKeys.UPDATE);
commerceDiscountAccountRelLocalService.
deleteCommerceDiscountAccountRelsByCommerceDiscountId(
commerceDiscountId);
}
@Override
public CommerceDiscountAccountRel fetchCommerceDiscountAccountRel(
long commerceDiscountId, long commerceAccountId)
throws PortalException {
CommerceDiscountAccountRel commerceDiscountAccountRel =
commerceDiscountAccountRelLocalService.
fetchCommerceDiscountAccountRel(
commerceDiscountId, commerceAccountId);
if (commerceDiscountAccountRel != null) {
_commerceDiscountResourcePermission.check(
getPermissionChecker(),
commerceDiscountAccountRel.getCommerceDiscountId(),
ActionKeys.UPDATE);
}
return commerceDiscountAccountRel;
}
@Override
public CommerceDiscountAccountRel getCommerceDiscountAccountRel(
long commerceDiscountAccountRelId)
throws PortalException {
CommerceDiscountAccountRel commerceDiscountAccountRel =
commerceDiscountAccountRelLocalService.
getCommerceDiscountAccountRel(commerceDiscountAccountRelId);
_commerceDiscountResourcePermission.check(
getPermissionChecker(),
commerceDiscountAccountRel.getCommerceDiscountId(),
ActionKeys.UPDATE);
return commerceDiscountAccountRel;
}
@Override
public List getCommerceDiscountAccountRels(
long commerceDiscountId, int start, int end,
OrderByComparator orderByComparator)
throws PortalException {
_commerceDiscountResourcePermission.check(
getPermissionChecker(), commerceDiscountId, ActionKeys.UPDATE);
return commerceDiscountAccountRelLocalService.
getCommerceDiscountAccountRels(
commerceDiscountId, start, end, orderByComparator);
}
@Override
public List getCommerceDiscountAccountRels(
long commerceDiscountId, String name, int start, int end) {
return commerceDiscountAccountRelFinder.findByCommerceDiscountId(
commerceDiscountId, name, start, end, true);
}
@Override
public int getCommerceDiscountAccountRelsCount(long commerceDiscountId)
throws PortalException {
_commerceDiscountResourcePermission.check(
getPermissionChecker(), commerceDiscountId, ActionKeys.UPDATE);
return commerceDiscountAccountRelLocalService.
getCommerceDiscountAccountRelsCount(commerceDiscountId);
}
@Override
public int getCommerceDiscountAccountRelsCount(
long commerceDiscountId, String name) {
return commerceDiscountAccountRelFinder.countByCommerceDiscountId(
commerceDiscountId, name, true);
}
private static volatile ModelResourcePermission
_commerceDiscountResourcePermission =
ModelResourcePermissionFactory.getInstance(
CommerceDiscountAccountRelServiceImpl.class,
"_commerceDiscountResourcePermission", CommerceDiscount.class);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy