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.portlet.shopping.model.ShoppingCategory;
21 import com.liferay.portlet.shopping.service.base.ShoppingCategoryServiceBaseImpl;
22 import com.liferay.portlet.shopping.service.permission.ShoppingCategoryPermission;
23
24
29 public class ShoppingCategoryServiceImpl
30 extends ShoppingCategoryServiceBaseImpl {
31
32 public ShoppingCategory addCategory(
33 long plid, long parentCategoryId, String name, String description,
34 boolean addCommunityPermissions, boolean addGuestPermissions)
35 throws PortalException, SystemException {
36
37 ShoppingCategoryPermission.check(
38 getPermissionChecker(), plid, parentCategoryId,
39 ActionKeys.ADD_CATEGORY);
40
41 return shoppingCategoryLocalService.addCategory(
42 getUserId(), plid, parentCategoryId, name, description,
43 addCommunityPermissions, addGuestPermissions);
44 }
45
46 public ShoppingCategory addCategory(
47 long plid, long parentCategoryId, String name, String description,
48 String[] communityPermissions, String[] guestPermissions)
49 throws PortalException, SystemException {
50
51 ShoppingCategoryPermission.check(
52 getPermissionChecker(), plid, parentCategoryId,
53 ActionKeys.ADD_CATEGORY);
54
55 return shoppingCategoryLocalService.addCategory(
56 getUserId(), plid, parentCategoryId, name, description,
57 communityPermissions, guestPermissions);
58 }
59
60 public void deleteCategory(long categoryId)
61 throws PortalException, SystemException {
62
63 ShoppingCategoryPermission.check(
64 getPermissionChecker(), categoryId, ActionKeys.DELETE);
65
66 shoppingCategoryLocalService.deleteCategory(categoryId);
67 }
68
69 public ShoppingCategory getCategory(long categoryId)
70 throws PortalException, SystemException {
71
72 ShoppingCategoryPermission.check(
73 getPermissionChecker(), categoryId, ActionKeys.VIEW);
74
75 return shoppingCategoryLocalService.getCategory(categoryId);
76 }
77
78 public ShoppingCategory updateCategory(
79 long categoryId, long parentCategoryId, String name,
80 String description, boolean mergeWithParentCategory)
81 throws PortalException, SystemException {
82
83 ShoppingCategoryPermission.check(
84 getPermissionChecker(), categoryId, ActionKeys.UPDATE);
85
86 return shoppingCategoryLocalService.updateCategory(
87 categoryId, parentCategoryId, name, description,
88 mergeWithParentCategory);
89 }
90
91 }