1
19
20 package com.liferay.portal.service.impl;
21
22 import com.liferay.portal.PortalException;
23 import com.liferay.portal.SystemException;
24 import com.liferay.portal.model.Phone;
25 import com.liferay.portal.security.permission.ActionKeys;
26 import com.liferay.portal.service.base.PhoneServiceBaseImpl;
27 import com.liferay.portal.service.permission.CommonPermissionUtil;
28
29 import java.util.List;
30
31
37 public class PhoneServiceImpl extends PhoneServiceBaseImpl {
38
39 public Phone addPhone(
40 String className, long classPK, String number, String extension,
41 int typeId, boolean primary)
42 throws PortalException, SystemException {
43
44 CommonPermissionUtil.check(
45 getPermissionChecker(), className, classPK, ActionKeys.UPDATE);
46
47 return phoneLocalService.addPhone(
48 getUserId(), className, classPK, number, extension, typeId,
49 primary);
50 }
51
52 public void deletePhone(long phoneId)
53 throws PortalException, SystemException {
54
55 Phone phone = phonePersistence.findByPrimaryKey(phoneId);
56
57 CommonPermissionUtil.check(
58 getPermissionChecker(), phone.getClassNameId(), phone.getClassPK(),
59 ActionKeys.UPDATE);
60
61 phoneLocalService.deletePhone(phoneId);
62 }
63
64 public Phone getPhone(long phoneId)
65 throws PortalException, SystemException {
66
67 Phone phone = phonePersistence.findByPrimaryKey(phoneId);
68
69 CommonPermissionUtil.check(
70 getPermissionChecker(), phone.getClassNameId(), phone.getClassPK(),
71 ActionKeys.VIEW);
72
73 return phone;
74 }
75
76 public List<Phone> getPhones(String className, long classPK)
77 throws PortalException, SystemException {
78
79 CommonPermissionUtil.check(
80 getPermissionChecker(), className, classPK, ActionKeys.VIEW);
81
82 return phoneLocalService.getPhones(
83 getUser().getCompanyId(), className, classPK);
84 }
85
86 public Phone updatePhone(
87 long phoneId, String number, String extension, int typeId,
88 boolean primary)
89 throws PortalException, SystemException {
90
91 Phone phone = phonePersistence.findByPrimaryKey(phoneId);
92
93 CommonPermissionUtil.check(
94 getPermissionChecker(), phone.getClassNameId(), phone.getClassPK(),
95 ActionKeys.UPDATE);
96
97 return phoneLocalService.updatePhone(
98 phoneId, number, extension, typeId, primary);
99 }
100
101 }