com.liferay.commerce.pricing.service.impl.CommercePriceModifierRelServiceImpl 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.service
Show all versions of com.liferay.commerce.pricing.service
Liferay Commerce Pricing Service
/**
* 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.service.impl;
import com.liferay.commerce.price.list.model.CommercePriceList;
import com.liferay.commerce.pricing.model.CommercePriceModifier;
import com.liferay.commerce.pricing.model.CommercePriceModifierRel;
import com.liferay.commerce.pricing.service.CommercePriceModifierLocalService;
import com.liferay.commerce.pricing.service.base.CommercePriceModifierRelServiceBaseImpl;
import com.liferay.portal.aop.AopService;
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.service.ClassNameLocalService;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.util.OrderByComparator;
import java.util.List;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Riccardo Alberti
*/
@Component(
property = {
"json.web.service.context.name=commerce",
"json.web.service.context.path=CommercePriceModifierRel"
},
service = AopService.class
)
public class CommercePriceModifierRelServiceImpl
extends CommercePriceModifierRelServiceBaseImpl {
@Override
public CommercePriceModifierRel addCommercePriceModifierRel(
long commercePriceModifierId, String className, long classPK,
ServiceContext serviceContext)
throws PortalException {
CommercePriceModifier commercePriceModifier =
_commercePriceModifierLocalService.getCommercePriceModifier(
commercePriceModifierId);
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.UPDATE);
return commercePriceModifierRelLocalService.addCommercePriceModifierRel(
commercePriceModifierId, className, classPK, serviceContext);
}
@Override
public void deleteCommercePriceModifierRel(long commercePriceModifierRelId)
throws PortalException {
CommercePriceModifierRel commercePriceModifierRel =
commercePriceModifierRelLocalService.getCommercePriceModifierRel(
commercePriceModifierRelId);
CommercePriceModifier commercePriceModifier =
commercePriceModifierRel.getCommercePriceModifier();
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.UPDATE);
commercePriceModifierRelLocalService.deleteCommercePriceModifierRel(
commercePriceModifierRel);
}
@Override
public CommercePriceModifierRel fetchCommercePriceModifierRel(
long commercePriceModifierId, String className, long classPK)
throws PortalException {
CommercePriceModifierRel commercePriceModifierRel =
commercePriceModifierRelLocalService.fetchCommercePriceModifierRel(
commercePriceModifierId, className, classPK);
CommercePriceModifier commercePriceModifier =
commercePriceModifierRel.getCommercePriceModifier();
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.VIEW);
return commercePriceModifierRel;
}
@Override
public List
getCategoriesCommercePriceModifierRels(
long commercePriceModifierId, String name, int start, int end) {
return commercePriceModifierRelFinder.
findCategoriesByCommercePriceModifierId(
commercePriceModifierId, name, start, end, true);
}
@Override
public int getCategoriesCommercePriceModifierRelsCount(
long commercePriceModifierId, String name) {
return commercePriceModifierRelFinder.
countCategoriesByCommercePriceModifierId(
commercePriceModifierId, name, true);
}
@Override
public long[] getClassPKs(long commercePriceModifierRelId, String className)
throws PortalException {
CommercePriceModifierRel commercePriceModifierRel =
commercePriceModifierRelLocalService.getCommercePriceModifierRel(
commercePriceModifierRelId);
CommercePriceModifier commercePriceModifier =
commercePriceModifierRel.getCommercePriceModifier();
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.VIEW);
return commercePriceModifierRelLocalService.getClassPKs(
commercePriceModifierRelId, className);
}
@Override
public CommercePriceModifierRel getCommercePriceModifierRel(
long commercePriceModifierRelId)
throws PortalException {
CommercePriceModifierRel commercePriceModifierRel =
commercePriceModifierRelLocalService.getCommercePriceModifierRel(
commercePriceModifierRelId);
CommercePriceModifier commercePriceModifier =
commercePriceModifierRel.getCommercePriceModifier();
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.VIEW);
return commercePriceModifierRel;
}
@Override
public List getCommercePriceModifierRels(
long commercePriceModifierRelId, String className)
throws PortalException {
CommercePriceModifierRel commercePriceModifierRel =
commercePriceModifierRelLocalService.getCommercePriceModifierRel(
commercePriceModifierRelId);
CommercePriceModifier commercePriceModifier =
commercePriceModifierRel.getCommercePriceModifier();
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.VIEW);
return commercePriceModifierRelLocalService.
getCommercePriceModifierRels(commercePriceModifierRelId, className);
}
@Override
public List getCommercePriceModifierRels(
long commercePriceModifierRelId, String className, int start,
int end,
OrderByComparator orderByComparator)
throws PortalException {
CommercePriceModifierRel commercePriceModifierRel =
commercePriceModifierRelLocalService.getCommercePriceModifierRel(
commercePriceModifierRelId);
CommercePriceModifier commercePriceModifier =
commercePriceModifierRel.getCommercePriceModifier();
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.VIEW);
return commercePriceModifierRelLocalService.
getCommercePriceModifierRels(
commercePriceModifierRelId, className, start, end,
orderByComparator);
}
@Override
public int getCommercePriceModifierRelsCount(
long commercePriceModifierRelId, String className)
throws PortalException {
CommercePriceModifierRel commercePriceModifierRel =
commercePriceModifierRelLocalService.getCommercePriceModifierRel(
commercePriceModifierRelId);
CommercePriceModifier commercePriceModifier =
commercePriceModifierRel.getCommercePriceModifier();
_commercePriceListModelResourcePermission.check(
getPermissionChecker(),
commercePriceModifier.getCommercePriceListId(), ActionKeys.VIEW);
return commercePriceModifierRelLocalService.
getCommercePriceModifierRelsCount(
commercePriceModifierRelId, className);
}
@Override
public List getCommercePriceModifiersRels(
String className, long classPK) {
return commercePriceModifierRelPersistence.findByCN_CPK(
_classNameLocalService.getClassNameId(className), classPK);
}
@Override
public List
getCommercePricingClassesCommercePriceModifierRels(
long commercePriceModifierId, String title, int start, int end) {
return commercePriceModifierRelFinder.
findPricingClassesByCommercePriceModifierId(
commercePriceModifierId, title, start, end, true);
}
@Override
public int getCommercePricingClassesCommercePriceModifierRelsCount(
long commercePriceModifierId, String title) {
return commercePriceModifierRelFinder.
countPricingClassesByCommercePriceModifierId(
commercePriceModifierId, title, true);
}
@Override
public List
getCPDefinitionsCommercePriceModifierRels(
long commercePriceModifierId, String name, String languageId,
int start, int end) {
return commercePriceModifierRelFinder.
findCPDefinitionsByCommercePriceModifierId(
commercePriceModifierId, name, languageId, start, end, true);
}
@Override
public int getCPDefinitionsCommercePriceModifierRelsCount(
long commercePriceModifierId, String name, String languageId) {
return commercePriceModifierRelFinder.
countCPDefinitionsByCommercePriceModifierId(
commercePriceModifierId, languageId, name, true);
}
@Reference
private ClassNameLocalService _classNameLocalService;
@Reference(
target = "(model.class.name=com.liferay.commerce.price.list.model.CommercePriceList)"
)
private ModelResourcePermission
_commercePriceListModelResourcePermission;
@Reference
private CommercePriceModifierLocalService
_commercePriceModifierLocalService;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy