1
22
23 package com.liferay.portlet.journal.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.kernel.security.permission.ActionKeys;
28 import com.liferay.portal.service.impl.PrincipalBean;
29 import com.liferay.portal.service.permission.PortletPermissionUtil;
30 import com.liferay.portal.util.PortletKeys;
31 import com.liferay.portlet.journal.model.JournalTemplate;
32 import com.liferay.portlet.journal.service.JournalTemplateLocalServiceUtil;
33 import com.liferay.portlet.journal.service.JournalTemplateService;
34 import com.liferay.portlet.journal.service.permission.JournalTemplatePermission;
35
36 import java.io.File;
37
38
44 public class JournalTemplateServiceImpl
45 extends PrincipalBean implements JournalTemplateService {
46
47 public JournalTemplate addTemplate(
48 String templateId, boolean autoTemplateId, long plid,
49 String structureId, String name, String description, String xsl,
50 boolean formatXsl, String langType, boolean smallImage,
51 String smallImageURL, File smallFile,
52 boolean addCommunityPermissions, boolean addGuestPermissions)
53 throws PortalException, SystemException {
54
55 PortletPermissionUtil.check(
56 getPermissionChecker(), plid, PortletKeys.JOURNAL,
57 ActionKeys.ADD_TEMPLATE);
58
59 return JournalTemplateLocalServiceUtil.addTemplate(
60 getUserId(), templateId, autoTemplateId, plid, structureId, name,
61 description, xsl, formatXsl, langType, smallImage, smallImageURL,
62 smallFile, addCommunityPermissions, addGuestPermissions);
63 }
64
65 public JournalTemplate addTemplate(
66 String templateId, boolean autoTemplateId, long plid,
67 String structureId, String name, String description, String xsl,
68 boolean formatXsl, String langType, boolean smallImage,
69 String smallImageURL, File smallFile, String[] communityPermissions,
70 String[] guestPermissions)
71 throws PortalException, SystemException {
72
73 PortletPermissionUtil.check(
74 getPermissionChecker(), plid, PortletKeys.JOURNAL,
75 ActionKeys.ADD_TEMPLATE);
76
77 return JournalTemplateLocalServiceUtil.addTemplate(
78 getUserId(), templateId, autoTemplateId, plid, structureId, name,
79 description, xsl, formatXsl, langType, smallImage, smallImageURL,
80 smallFile, communityPermissions, guestPermissions);
81 }
82
83 public void deleteTemplate(long groupId, String templateId)
84 throws PortalException, SystemException {
85
86 JournalTemplatePermission.check(
87 getPermissionChecker(), groupId, templateId, ActionKeys.DELETE);
88
89 JournalTemplateLocalServiceUtil.deleteTemplate(groupId, templateId);
90 }
91
92 public JournalTemplate getTemplate(long groupId, String templateId)
93 throws PortalException, SystemException {
94
95 JournalTemplatePermission.check(
96 getPermissionChecker(), groupId, templateId, ActionKeys.VIEW);
97
98 return JournalTemplateLocalServiceUtil.getTemplate(groupId, templateId);
99 }
100
101 public JournalTemplate updateTemplate(
102 long groupId, String templateId, String structureId, String name,
103 String description, String xsl, boolean formatXsl, String langType,
104 boolean smallImage, String smallImageURL, File smallFile)
105 throws PortalException, SystemException {
106
107 JournalTemplatePermission.check(
108 getPermissionChecker(), groupId, templateId, ActionKeys.UPDATE);
109
110 return JournalTemplateLocalServiceUtil.updateTemplate(
111 groupId, templateId, structureId, name, description, xsl, formatXsl,
112 langType, smallImage, smallImageURL, smallFile);
113 }
114
115 }