001
014
015 package com.liferay.portal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.model.User;
020 import com.liferay.portal.model.Website;
021 import com.liferay.portal.security.permission.ActionKeys;
022 import com.liferay.portal.service.ServiceContext;
023 import com.liferay.portal.service.base.WebsiteServiceBaseImpl;
024 import com.liferay.portal.service.permission.CommonPermissionUtil;
025
026 import java.util.List;
027
028
031 public class WebsiteServiceImpl extends WebsiteServiceBaseImpl {
032
033
037 @Override
038 public Website addWebsite(
039 String className, long classPK, String url, int typeId,
040 boolean primary)
041 throws PortalException, SystemException {
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, int typeId,
053 boolean primary, ServiceContext serviceContext)
054 throws PortalException, SystemException {
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)
066 throws PortalException, SystemException {
067
068 Website website = websitePersistence.findByPrimaryKey(websiteId);
069
070 CommonPermissionUtil.check(
071 getPermissionChecker(), website.getClassNameId(),
072 website.getClassPK(), ActionKeys.UPDATE);
073
074 websiteLocalService.deleteWebsite(websiteId);
075 }
076
077 @Override
078 public Website getWebsite(long websiteId)
079 throws PortalException, SystemException {
080
081 Website website = websitePersistence.findByPrimaryKey(websiteId);
082
083 CommonPermissionUtil.check(
084 getPermissionChecker(), website.getClassNameId(),
085 website.getClassPK(), ActionKeys.VIEW);
086
087 return website;
088 }
089
090 @Override
091 public List<Website> getWebsites(String className, long classPK)
092 throws PortalException, SystemException {
093
094 CommonPermissionUtil.check(
095 getPermissionChecker(), className, classPK, ActionKeys.VIEW);
096
097 User user = getUser();
098
099 return websiteLocalService.getWebsites(
100 user.getCompanyId(), className, classPK);
101 }
102
103 @Override
104 public Website updateWebsite(
105 long websiteId, String url, int typeId, boolean primary)
106 throws PortalException, SystemException {
107
108 Website website = websitePersistence.findByPrimaryKey(websiteId);
109
110 CommonPermissionUtil.check(
111 getPermissionChecker(), website.getClassNameId(),
112 website.getClassPK(), ActionKeys.UPDATE);
113
114 return websiteLocalService.updateWebsite(
115 websiteId, url, typeId, primary);
116 }
117
118 }