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,
043 boolean formatXsl, String langType, boolean cacheable,
044 boolean smallImage, String smallImageURL, File smallFile,
045 ServiceContext serviceContext)
046 throws PortalException, SystemException {
047
048 JournalPermission.check(
049 getPermissionChecker(), groupId, ActionKeys.ADD_TEMPLATE);
050
051 return journalTemplateLocalService.addTemplate(
052 getUserId(), groupId, templateId, autoTemplateId, structureId,
053 nameMap, descriptionMap, xsl, formatXsl, langType, cacheable,
054 smallImage, smallImageURL, smallFile, serviceContext);
055 }
056
057 public JournalTemplate addTemplate(
058 long groupId, String templateId, boolean autoTemplateId,
059 String structureId, Map<Locale, String> nameMap,
060 Map<Locale, String> descriptionMap, String xsl,
061 boolean formatXsl, String langType, boolean cacheable,
062 ServiceContext serviceContext)
063 throws PortalException, SystemException {
064
065 JournalPermission.check(
066 getPermissionChecker(), groupId, ActionKeys.ADD_TEMPLATE);
067
068 return journalTemplateLocalService.addTemplate(
069 getUserId(), groupId, templateId, autoTemplateId, structureId,
070 nameMap, descriptionMap, xsl, formatXsl, langType, cacheable, false,
071 null, null, serviceContext);
072 }
073
074 public JournalTemplate copyTemplate(
075 long groupId, String oldTemplateId, String newTemplateId,
076 boolean autoTemplateId)
077 throws PortalException, SystemException {
078
079 JournalPermission.check(
080 getPermissionChecker(), groupId, ActionKeys.ADD_TEMPLATE);
081
082 return journalTemplateLocalService.copyTemplate(
083 getUserId(), groupId, oldTemplateId, newTemplateId, autoTemplateId);
084 }
085
086 public void deleteTemplate(long groupId, String templateId)
087 throws PortalException, SystemException {
088
089 JournalTemplatePermission.check(
090 getPermissionChecker(), groupId, templateId, ActionKeys.DELETE);
091
092 journalTemplateLocalService.deleteTemplate(groupId, templateId);
093 }
094
095 public List<JournalTemplate> getStructureTemplates(
096 long groupId, String structureId)
097 throws SystemException {
098
099 return journalTemplatePersistence.filterFindByG_S(groupId, structureId);
100 }
101
102 public JournalTemplate getTemplate(long groupId, String templateId)
103 throws PortalException, SystemException {
104
105 JournalTemplatePermission.check(
106 getPermissionChecker(), groupId, templateId, ActionKeys.VIEW);
107
108 return journalTemplateLocalService.getTemplate(groupId, templateId);
109 }
110
111 public List<JournalTemplate> search(
112 long companyId, long[] groupIds, String keywords,
113 String structureId, String structureIdComparator, int start,
114 int end, OrderByComparator obc)
115 throws SystemException {
116
117 return journalTemplateFinder.filterFindByKeywords(
118 companyId, groupIds, keywords, structureId, structureIdComparator,
119 start, end, obc);
120 }
121
122 public List<JournalTemplate> search(
123 long companyId, long[] groupIds, String templateId,
124 String structureId, String structureIdComparator, String name,
125 String description, boolean andOperator, int start, int end,
126 OrderByComparator obc)
127 throws SystemException {
128
129 return journalTemplateFinder.filterFindByC_G_T_S_N_D(
130 companyId, groupIds, templateId, structureId, structureIdComparator,
131 name, description, andOperator, start, end, obc);
132 }
133
134 public int searchCount(
135 long companyId, long[] groupIds, String keywords,
136 String structureId, String structureIdComparator)
137 throws SystemException {
138
139 return journalTemplateFinder.filterCountByKeywords(
140 companyId, groupIds, keywords, structureId, structureIdComparator);
141 }
142
143 public int searchCount(
144 long companyId, long[] groupIds, String templateId,
145 String structureId, String structureIdComparator, String name,
146 String description,
147 boolean andOperator)
148 throws SystemException {
149
150 return journalTemplateFinder.filterCountByC_G_T_S_N_D(
151 companyId, groupIds, templateId, structureId, structureIdComparator,
152 name, description, andOperator);
153 }
154
155 public JournalTemplate updateTemplate(
156 long groupId, String templateId, String structureId,
157 Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
158 String xsl, boolean formatXsl, String langType, boolean cacheable,
159 boolean smallImage, String smallImageURL, File smallFile,
160 ServiceContext serviceContext)
161 throws PortalException, SystemException {
162
163 JournalTemplatePermission.check(
164 getPermissionChecker(), groupId, templateId, ActionKeys.UPDATE);
165
166 return journalTemplateLocalService.updateTemplate(
167 groupId, templateId, structureId, nameMap, descriptionMap, xsl,
168 formatXsl, langType, cacheable, smallImage, smallImageURL,
169 smallFile, serviceContext);
170 }
171
172 public JournalTemplate updateTemplate(
173 long groupId, String templateId, String structureId,
174 Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
175 String xsl, boolean formatXsl, String langType, boolean cacheable,
176 ServiceContext serviceContext)
177 throws PortalException, SystemException {
178
179 JournalTemplatePermission.check(
180 getPermissionChecker(), groupId, templateId, ActionKeys.UPDATE);
181
182 return journalTemplateLocalService.updateTemplate(
183 groupId, templateId, structureId, nameMap, descriptionMap, xsl,
184 formatXsl, langType, cacheable, false, null, null, serviceContext);
185 }
186
187 }