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