001
014
015 package com.liferay.portlet.journal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.OrderByComparator;
020 import com.liferay.portal.security.permission.ActionKeys;
021 import com.liferay.portal.service.ServiceContext;
022 import com.liferay.portlet.journal.model.JournalTemplate;
023 import com.liferay.portlet.journal.service.base.JournalTemplateServiceBaseImpl;
024 import com.liferay.portlet.journal.service.permission.JournalPermission;
025 import com.liferay.portlet.journal.service.permission.JournalTemplatePermission;
026
027 import java.io.File;
028
029 import java.util.List;
030 import java.util.Locale;
031 import java.util.Map;
032
033
037 public class JournalTemplateServiceImpl extends JournalTemplateServiceBaseImpl {
038
039 public JournalTemplate addTemplate(
040 long groupId, String templateId, boolean autoTemplateId,
041 String structureId, Map<Locale, String> nameMap,
042 Map<Locale, String> descriptionMap, String xsl, boolean formatXsl,
043 String langType, boolean cacheable, boolean smallImage,
044 String smallImageURL, File smallFile, ServiceContext serviceContext)
045 throws PortalException, SystemException {
046
047 JournalPermission.check(
048 getPermissionChecker(), groupId, ActionKeys.ADD_TEMPLATE);
049
050 return journalTemplateLocalService.addTemplate(
051 getUserId(), groupId, templateId, autoTemplateId, structureId,
052 nameMap, descriptionMap, xsl, formatXsl, langType, cacheable,
053 smallImage, smallImageURL, smallFile, serviceContext);
054 }
055
056 public JournalTemplate addTemplate(
057 long groupId, String templateId, boolean autoTemplateId,
058 String structureId, Map<Locale, String> nameMap,
059 Map<Locale, String> descriptionMap, String xsl, boolean formatXsl,
060 String langType, boolean cacheable, ServiceContext serviceContext)
061 throws PortalException, SystemException {
062
063 JournalPermission.check(
064 getPermissionChecker(), groupId, ActionKeys.ADD_TEMPLATE);
065
066 return journalTemplateLocalService.addTemplate(
067 getUserId(), groupId, templateId, autoTemplateId, structureId,
068 nameMap, descriptionMap, xsl, formatXsl, langType, cacheable, false,
069 null, null, serviceContext);
070 }
071
072 public JournalTemplate copyTemplate(
073 long groupId, String oldTemplateId, String newTemplateId,
074 boolean autoTemplateId)
075 throws PortalException, SystemException {
076
077 JournalPermission.check(
078 getPermissionChecker(), groupId, ActionKeys.ADD_TEMPLATE);
079
080 return journalTemplateLocalService.copyTemplate(
081 getUserId(), groupId, oldTemplateId, newTemplateId, autoTemplateId);
082 }
083
084 public void deleteTemplate(long groupId, String templateId)
085 throws PortalException, SystemException {
086
087 JournalTemplatePermission.check(
088 getPermissionChecker(), groupId, templateId, ActionKeys.DELETE);
089
090 journalTemplateLocalService.deleteTemplate(groupId, templateId);
091 }
092
093 public List<JournalTemplate> getStructureTemplates(
094 long groupId, String structureId)
095 throws SystemException {
096
097 return journalTemplatePersistence.filterFindByG_S(groupId, structureId);
098 }
099
100 public JournalTemplate getTemplate(long groupId, String templateId)
101 throws PortalException, SystemException {
102
103 JournalTemplatePermission.check(
104 getPermissionChecker(), groupId, templateId, ActionKeys.VIEW);
105
106 return journalTemplateLocalService.getTemplate(groupId, templateId);
107 }
108
109 public List<JournalTemplate> search(
110 long companyId, long[] groupIds, String keywords,
111 String structureId, String structureIdComparator, int start,
112 int end, OrderByComparator obc)
113 throws SystemException {
114
115 return journalTemplateFinder.filterFindByKeywords(
116 companyId, groupIds, keywords, structureId, structureIdComparator,
117 start, end, obc);
118 }
119
120 public List<JournalTemplate> search(
121 long companyId, long[] groupIds, String templateId,
122 String structureId, String structureIdComparator, String name,
123 String description, boolean andOperator, int start, int end,
124 OrderByComparator obc)
125 throws SystemException {
126
127 return journalTemplateFinder.filterFindByC_G_T_S_N_D(
128 companyId, groupIds, templateId, structureId, structureIdComparator,
129 name, description, andOperator, start, end, obc);
130 }
131
132 public int searchCount(
133 long companyId, long[] groupIds, String keywords,
134 String structureId, String structureIdComparator)
135 throws SystemException {
136
137 return journalTemplateFinder.filterCountByKeywords(
138 companyId, groupIds, keywords, structureId, structureIdComparator);
139 }
140
141 public int searchCount(
142 long companyId, long[] groupIds, String templateId,
143 String structureId, String structureIdComparator, String name,
144 String description, boolean andOperator)
145 throws SystemException {
146
147 return journalTemplateFinder.filterCountByC_G_T_S_N_D(
148 companyId, groupIds, templateId, structureId, structureIdComparator,
149 name, description, andOperator);
150 }
151
152 public JournalTemplate updateTemplate(
153 long groupId, String templateId, String structureId,
154 Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
155 String xsl, boolean formatXsl, String langType, boolean cacheable,
156 boolean smallImage, String smallImageURL, File smallFile,
157 ServiceContext serviceContext)
158 throws PortalException, SystemException {
159
160 JournalTemplatePermission.check(
161 getPermissionChecker(), groupId, templateId, ActionKeys.UPDATE);
162
163 return journalTemplateLocalService.updateTemplate(
164 groupId, templateId, structureId, nameMap, descriptionMap, xsl,
165 formatXsl, langType, cacheable, smallImage, smallImageURL,
166 smallFile, serviceContext);
167 }
168
169 public JournalTemplate updateTemplate(
170 long groupId, String templateId, String structureId,
171 Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
172 String xsl, boolean formatXsl, String langType, boolean cacheable,
173 ServiceContext serviceContext)
174 throws PortalException, SystemException {
175
176 JournalTemplatePermission.check(
177 getPermissionChecker(), groupId, templateId, ActionKeys.UPDATE);
178
179 return journalTemplateLocalService.updateTemplate(
180 groupId, templateId, structureId, nameMap, descriptionMap, xsl,
181 formatXsl, langType, cacheable, false, null, null, serviceContext);
182 }
183
184 }