001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.journal.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.kernel.security.permission.ActionKeys;
026: import com.liferay.portal.service.permission.PortletPermissionUtil;
027: import com.liferay.portal.util.PortletKeys;
028: import com.liferay.portlet.journal.model.JournalTemplate;
029: import com.liferay.portlet.journal.service.base.JournalTemplateServiceBaseImpl;
030: import com.liferay.portlet.journal.service.permission.JournalTemplatePermission;
031:
032: import java.io.File;
033:
034: /**
035: * <a href="JournalTemplateServiceImpl.java.html"><b><i>View Source</i></b></a>
036: *
037: * @author Brian Wing Shun Chan
038: *
039: */
040: public class JournalTemplateServiceImpl extends
041: JournalTemplateServiceBaseImpl {
042:
043: public JournalTemplate addTemplate(String templateId,
044: boolean autoTemplateId, long plid, String structureId,
045: String name, String description, String xsl,
046: boolean formatXsl, String langType, boolean cacheable,
047: boolean smallImage, String smallImageURL, File smallFile,
048: boolean addCommunityPermissions, boolean addGuestPermissions)
049: throws PortalException, SystemException {
050:
051: PortletPermissionUtil.check(getPermissionChecker(), plid,
052: PortletKeys.JOURNAL, ActionKeys.ADD_TEMPLATE);
053:
054: return journalTemplateLocalService.addTemplate(getUserId(),
055: templateId, autoTemplateId, plid, structureId, name,
056: description, xsl, formatXsl, langType, cacheable,
057: smallImage, smallImageURL, smallFile,
058: addCommunityPermissions, addGuestPermissions);
059: }
060:
061: public JournalTemplate addTemplate(String templateId,
062: boolean autoTemplateId, long plid, String structureId,
063: String name, String description, String xsl,
064: boolean formatXsl, String langType, boolean cacheable,
065: boolean smallImage, String smallImageURL, File smallFile,
066: String[] communityPermissions, String[] guestPermissions)
067: throws PortalException, SystemException {
068:
069: PortletPermissionUtil.check(getPermissionChecker(), plid,
070: PortletKeys.JOURNAL, ActionKeys.ADD_TEMPLATE);
071:
072: return journalTemplateLocalService.addTemplate(getUserId(),
073: templateId, autoTemplateId, plid, structureId, name,
074: description, xsl, formatXsl, langType, cacheable,
075: smallImage, smallImageURL, smallFile,
076: communityPermissions, guestPermissions);
077: }
078:
079: public void deleteTemplate(long groupId, String templateId)
080: throws PortalException, SystemException {
081:
082: JournalTemplatePermission.check(getPermissionChecker(),
083: groupId, templateId, ActionKeys.DELETE);
084:
085: journalTemplateLocalService.deleteTemplate(groupId, templateId);
086: }
087:
088: public JournalTemplate getTemplate(long groupId, String templateId)
089: throws PortalException, SystemException {
090:
091: JournalTemplatePermission.check(getPermissionChecker(),
092: groupId, templateId, ActionKeys.VIEW);
093:
094: return journalTemplateLocalService.getTemplate(groupId,
095: templateId);
096: }
097:
098: public JournalTemplate updateTemplate(long groupId,
099: String templateId, String structureId, String name,
100: String description, String xsl, boolean formatXsl,
101: String langType, boolean cacheable, boolean smallImage,
102: String smallImageURL, File smallFile)
103: throws PortalException, SystemException {
104:
105: JournalTemplatePermission.check(getPermissionChecker(),
106: groupId, templateId, ActionKeys.UPDATE);
107:
108: return journalTemplateLocalService.updateTemplate(groupId,
109: templateId, structureId, name, description, xsl,
110: formatXsl, langType, cacheable, smallImage,
111: smallImageURL, smallFile);
112: }
113:
114: }
|