001
014
015 package com.liferay.portlet.wiki.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.security.permission.ActionKeys;
020 import com.liferay.portal.service.ServiceContext;
021 import com.liferay.portlet.wiki.model.WikiNode;
022 import com.liferay.portlet.wiki.service.base.WikiNodeServiceBaseImpl;
023 import com.liferay.portlet.wiki.service.permission.WikiNodePermission;
024 import com.liferay.portlet.wiki.service.permission.WikiPermission;
025
026 import java.io.File;
027
028 import java.util.Map;
029
030
034 public class WikiNodeServiceImpl extends WikiNodeServiceBaseImpl {
035
036 public WikiNode addNode(
037 String name, String description, ServiceContext serviceContext)
038 throws PortalException, SystemException {
039
040 WikiPermission.check(
041 getPermissionChecker(), serviceContext.getScopeGroupId(),
042 ActionKeys.ADD_NODE);
043
044 return wikiNodeLocalService.addNode(
045 getUserId(), name, description, serviceContext);
046 }
047
048 public void deleteNode(long nodeId)
049 throws PortalException, SystemException {
050
051 WikiNodePermission.check(
052 getPermissionChecker(), nodeId, ActionKeys.DELETE);
053
054 wikiNodeLocalService.deleteNode(nodeId);
055 }
056
057 public WikiNode getNode(long nodeId)
058 throws PortalException, SystemException {
059
060 WikiNodePermission.check(
061 getPermissionChecker(), nodeId, ActionKeys.VIEW);
062
063 return wikiNodeLocalService.getNode(nodeId);
064 }
065
066 public WikiNode getNode(long groupId, String name)
067 throws PortalException, SystemException {
068
069 WikiNodePermission.check(
070 getPermissionChecker(), groupId, name, ActionKeys.VIEW);
071
072 return wikiNodeLocalService.getNode(groupId, name);
073 }
074
075 public void importPages(
076 long nodeId, String importer, File[] files,
077 Map<String, String[]> options)
078 throws PortalException, SystemException {
079
080 WikiNodePermission.check(
081 getPermissionChecker(), nodeId, ActionKeys.IMPORT);
082
083 wikiNodeLocalService.importPages(
084 getUserId(), nodeId, importer, files, options);
085 }
086
087 public void subscribeNode(long nodeId)
088 throws PortalException, SystemException {
089
090 WikiNodePermission.check(
091 getPermissionChecker(), nodeId, ActionKeys.SUBSCRIBE);
092
093 wikiNodeLocalService.subscribeNode(getUserId(), nodeId);
094 }
095
096 public void unsubscribeNode(long nodeId)
097 throws PortalException, SystemException {
098
099 WikiNodePermission.check(
100 getPermissionChecker(), nodeId, ActionKeys.SUBSCRIBE);
101
102 wikiNodeLocalService.unsubscribeNode(getUserId(), nodeId);
103 }
104
105 public WikiNode updateNode(
106 long nodeId, String name, String description,
107 ServiceContext serviceContext)
108 throws PortalException, SystemException {
109
110 WikiNodePermission.check(
111 getPermissionChecker(), nodeId, ActionKeys.UPDATE);
112
113 return wikiNodeLocalService.updateNode(
114 nodeId, name, description, serviceContext);
115 }
116
117 }