1
14
15 package com.liferay.portal.service.impl;
16
17 import com.liferay.portal.PortalException;
18 import com.liferay.portal.SystemException;
19 import com.liferay.portal.model.Website;
20 import com.liferay.portal.security.permission.ActionKeys;
21 import com.liferay.portal.service.base.WebsiteServiceBaseImpl;
22 import com.liferay.portal.service.permission.CommonPermissionUtil;
23
24 import java.util.List;
25
26
31 public class WebsiteServiceImpl extends WebsiteServiceBaseImpl {
32
33 public Website addWebsite(
34 String className, long classPK, String url, int typeId,
35 boolean primary)
36 throws PortalException, SystemException {
37
38 CommonPermissionUtil.check(
39 getPermissionChecker(), className, classPK, ActionKeys.UPDATE);
40
41 return websiteLocalService.addWebsite(
42 getUserId(), className, classPK, url, typeId, primary);
43 }
44
45 public void deleteWebsite(long websiteId)
46 throws PortalException, SystemException {
47
48 Website website = websitePersistence.findByPrimaryKey(websiteId);
49
50 CommonPermissionUtil.check(
51 getPermissionChecker(), website.getClassNameId(),
52 website.getClassPK(), ActionKeys.UPDATE);
53
54 websiteLocalService.deleteWebsite(websiteId);
55 }
56
57 public Website getWebsite(long websiteId)
58 throws PortalException, SystemException {
59
60 Website website = websitePersistence.findByPrimaryKey(websiteId);
61
62 CommonPermissionUtil.check(
63 getPermissionChecker(), website.getClassNameId(),
64 website.getClassPK(), ActionKeys.VIEW);
65
66 return website;
67 }
68
69 public List<Website> getWebsites(String className, long classPK)
70 throws PortalException, SystemException {
71
72 CommonPermissionUtil.check(
73 getPermissionChecker(), className, classPK, ActionKeys.VIEW);
74
75 return websiteLocalService.getWebsites(
76 getUser().getCompanyId(), className, classPK);
77 }
78
79 public Website updateWebsite(
80 long websiteId, String url, int typeId, boolean primary)
81 throws PortalException, SystemException {
82
83 Website website = websitePersistence.findByPrimaryKey(websiteId);
84
85 CommonPermissionUtil.check(
86 getPermissionChecker(), website.getClassNameId(),
87 website.getClassPK(), ActionKeys.UPDATE);
88
89 return websiteLocalService.updateWebsite(
90 websiteId, url, typeId, primary);
91 }
92
93 }