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