1
14
15 package com.liferay.portlet.shopping.service.impl;
16
17 import com.liferay.portal.PortalException;
18 import com.liferay.portal.SystemException;
19 import com.liferay.portal.security.permission.ActionKeys;
20 import com.liferay.portal.service.ServiceContext;
21 import com.liferay.portlet.shopping.model.ShoppingCategory;
22 import com.liferay.portlet.shopping.service.base.ShoppingCategoryServiceBaseImpl;
23 import com.liferay.portlet.shopping.service.permission.ShoppingCategoryPermission;
24
25
30 public class ShoppingCategoryServiceImpl
31 extends ShoppingCategoryServiceBaseImpl {
32
33 public ShoppingCategory addCategory(
34 long parentCategoryId, String name, String description,
35 ServiceContext serviceContext)
36 throws PortalException, SystemException {
37
38 ShoppingCategoryPermission.check(
39 getPermissionChecker(), serviceContext.getScopeGroupId(),
40 parentCategoryId, ActionKeys.ADD_CATEGORY);
41
42 return shoppingCategoryLocalService.addCategory(
43 getUserId(), parentCategoryId, name, description, serviceContext);
44 }
45
46 public void deleteCategory(long categoryId)
47 throws PortalException, SystemException {
48
49 ShoppingCategoryPermission.check(
50 getPermissionChecker(), categoryId, ActionKeys.DELETE);
51
52 shoppingCategoryLocalService.deleteCategory(categoryId);
53 }
54
55 public ShoppingCategory getCategory(long categoryId)
56 throws PortalException, SystemException {
57
58 ShoppingCategoryPermission.check(
59 getPermissionChecker(), categoryId, ActionKeys.VIEW);
60
61 return shoppingCategoryLocalService.getCategory(categoryId);
62 }
63
64 public ShoppingCategory updateCategory(
65 long categoryId, long parentCategoryId, String name,
66 String description, boolean mergeWithParentCategory,
67 ServiceContext serviceContext)
68 throws PortalException, SystemException {
69
70 ShoppingCategoryPermission.check(
71 getPermissionChecker(), categoryId, ActionKeys.UPDATE);
72
73 return shoppingCategoryLocalService.updateCategory(
74 categoryId, parentCategoryId, name, description,
75 mergeWithParentCategory, serviceContext);
76 }
77
78 }