001
014
015 package com.liferay.portal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.model.Phone;
019 import com.liferay.portal.model.User;
020 import com.liferay.portal.security.permission.ActionKeys;
021 import com.liferay.portal.service.ServiceContext;
022 import com.liferay.portal.service.base.PhoneServiceBaseImpl;
023 import com.liferay.portal.service.permission.CommonPermissionUtil;
024
025 import java.util.List;
026
027
030 public class PhoneServiceImpl extends PhoneServiceBaseImpl {
031
032
036 @Deprecated
037 @Override
038 public Phone addPhone(
039 String className, long classPK, String number, String extension,
040 long typeId, boolean primary)
041 throws PortalException {
042
043 CommonPermissionUtil.check(
044 getPermissionChecker(), className, classPK, ActionKeys.UPDATE);
045
046 return phoneLocalService.addPhone(
047 getUserId(), className, classPK, number, extension, typeId,
048 primary);
049 }
050
051 @Override
052 public Phone addPhone(
053 String className, long classPK, String number, String extension,
054 long typeId, boolean primary, ServiceContext serviceContext)
055 throws PortalException {
056
057 CommonPermissionUtil.check(
058 getPermissionChecker(), className, classPK, ActionKeys.UPDATE);
059
060 return phoneLocalService.addPhone(
061 getUserId(), className, classPK, number, extension, typeId, primary,
062 serviceContext);
063 }
064
065 @Override
066 public void deletePhone(long phoneId) throws PortalException {
067 Phone phone = phonePersistence.findByPrimaryKey(phoneId);
068
069 CommonPermissionUtil.check(
070 getPermissionChecker(), phone.getClassNameId(), phone.getClassPK(),
071 ActionKeys.UPDATE);
072
073 phoneLocalService.deletePhone(phone);
074 }
075
076 @Override
077 public Phone getPhone(long phoneId) throws PortalException {
078 Phone phone = phonePersistence.findByPrimaryKey(phoneId);
079
080 CommonPermissionUtil.check(
081 getPermissionChecker(), phone.getClassNameId(), phone.getClassPK(),
082 ActionKeys.VIEW);
083
084 return phone;
085 }
086
087 @Override
088 public List<Phone> getPhones(String className, long classPK)
089 throws PortalException {
090
091 CommonPermissionUtil.check(
092 getPermissionChecker(), className, classPK, ActionKeys.VIEW);
093
094 User user = getUser();
095
096 return phoneLocalService.getPhones(
097 user.getCompanyId(), className, classPK);
098 }
099
100 @Override
101 public Phone updatePhone(
102 long phoneId, String number, String extension, long typeId,
103 boolean primary)
104 throws PortalException {
105
106 Phone phone = phonePersistence.findByPrimaryKey(phoneId);
107
108 CommonPermissionUtil.check(
109 getPermissionChecker(), phone.getClassNameId(), phone.getClassPK(),
110 ActionKeys.UPDATE);
111
112 return phoneLocalService.updatePhone(
113 phoneId, number, extension, typeId, primary);
114 }
115
116 }