1
19
20 package com.liferay.portlet.shopping.service.impl;
21
22 import com.liferay.portal.PortalException;
23 import com.liferay.portal.SystemException;
24 import com.liferay.portal.security.permission.ActionKeys;
25 import com.liferay.portlet.shopping.model.ShoppingCategory;
26 import com.liferay.portlet.shopping.service.base.ShoppingCategoryServiceBaseImpl;
27 import com.liferay.portlet.shopping.service.permission.ShoppingCategoryPermission;
28
29
35 public class ShoppingCategoryServiceImpl
36 extends ShoppingCategoryServiceBaseImpl {
37
38 public ShoppingCategory addCategory(
39 long plid, long parentCategoryId, String name, String description,
40 boolean addCommunityPermissions, boolean addGuestPermissions)
41 throws PortalException, SystemException {
42
43 ShoppingCategoryPermission.check(
44 getPermissionChecker(), plid, parentCategoryId,
45 ActionKeys.ADD_CATEGORY);
46
47 return shoppingCategoryLocalService.addCategory(
48 getUserId(), plid, parentCategoryId, name, description,
49 addCommunityPermissions, addGuestPermissions);
50 }
51
52 public ShoppingCategory addCategory(
53 long plid, long parentCategoryId, String name, String description,
54 String[] communityPermissions, String[] guestPermissions)
55 throws PortalException, SystemException {
56
57 ShoppingCategoryPermission.check(
58 getPermissionChecker(), plid, parentCategoryId,
59 ActionKeys.ADD_CATEGORY);
60
61 return shoppingCategoryLocalService.addCategory(
62 getUserId(), plid, parentCategoryId, name, description,
63 communityPermissions, guestPermissions);
64 }
65
66 public void deleteCategory(long categoryId)
67 throws PortalException, SystemException {
68
69 ShoppingCategoryPermission.check(
70 getPermissionChecker(), categoryId, ActionKeys.DELETE);
71
72 shoppingCategoryLocalService.deleteCategory(categoryId);
73 }
74
75 public ShoppingCategory getCategory(long categoryId)
76 throws PortalException, SystemException {
77
78 ShoppingCategoryPermission.check(
79 getPermissionChecker(), categoryId, ActionKeys.VIEW);
80
81 return shoppingCategoryLocalService.getCategory(categoryId);
82 }
83
84 public ShoppingCategory updateCategory(
85 long categoryId, long parentCategoryId, String name,
86 String description, boolean mergeWithParentCategory)
87 throws PortalException, SystemException {
88
89 ShoppingCategoryPermission.check(
90 getPermissionChecker(), categoryId, ActionKeys.UPDATE);
91
92 return shoppingCategoryLocalService.updateCategory(
93 categoryId, parentCategoryId, name, description,
94 mergeWithParentCategory);
95 }
96
97 }