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.JournalStructure;
029: import com.liferay.portlet.journal.service.base.JournalStructureServiceBaseImpl;
030: import com.liferay.portlet.journal.service.permission.JournalStructurePermission;
031:
032: /**
033: * <a href="JournalStructureServiceImpl.java.html"><b><i>View Source</i></b></a>
034: *
035: * @author Brian Wing Shun Chan
036: *
037: */
038: public class JournalStructureServiceImpl extends
039: JournalStructureServiceBaseImpl {
040:
041: public JournalStructure addStructure(String structureId,
042: boolean autoStructureId, long plid, String name,
043: String description, String xsd,
044: boolean addCommunityPermissions, boolean addGuestPermissions)
045: throws PortalException, SystemException {
046:
047: PortletPermissionUtil.check(getPermissionChecker(), plid,
048: PortletKeys.JOURNAL, ActionKeys.ADD_STRUCTURE);
049:
050: return journalStructureLocalService.addStructure(getUserId(),
051: structureId, autoStructureId, plid, name, description,
052: xsd, addCommunityPermissions, addGuestPermissions);
053: }
054:
055: public JournalStructure addStructure(String structureId,
056: boolean autoStructureId, long plid, String name,
057: String description, String xsd,
058: String[] communityPermissions, String[] guestPermissions)
059: throws PortalException, SystemException {
060:
061: PortletPermissionUtil.check(getPermissionChecker(), plid,
062: PortletKeys.JOURNAL, ActionKeys.ADD_STRUCTURE);
063:
064: return journalStructureLocalService.addStructure(getUserId(),
065: structureId, autoStructureId, plid, name, description,
066: xsd, communityPermissions, guestPermissions);
067: }
068:
069: public void deleteStructure(long groupId, String structureId)
070: throws PortalException, SystemException {
071:
072: JournalStructurePermission.check(getPermissionChecker(),
073: groupId, structureId, ActionKeys.DELETE);
074:
075: journalStructureLocalService.deleteStructure(groupId,
076: structureId);
077: }
078:
079: public JournalStructure getStructure(long groupId,
080: String structureId) throws PortalException, SystemException {
081:
082: JournalStructurePermission.check(getPermissionChecker(),
083: groupId, structureId, ActionKeys.VIEW);
084:
085: return journalStructureLocalService.getStructure(groupId,
086: structureId);
087: }
088:
089: public JournalStructure updateStructure(long groupId,
090: String structureId, String name, String description,
091: String xsd) throws PortalException, SystemException {
092:
093: JournalStructurePermission.check(getPermissionChecker(),
094: groupId, structureId, ActionKeys.UPDATE);
095:
096: return journalStructureLocalService.updateStructure(groupId,
097: structureId, name, description, xsd);
098: }
099:
100: }
|