1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.portlet.journal.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.security.permission.ActionKeys;
20  import com.liferay.portal.service.permission.PortletPermissionUtil;
21  import com.liferay.portal.util.PortletKeys;
22  import com.liferay.portlet.journal.model.JournalStructure;
23  import com.liferay.portlet.journal.service.base.JournalStructureServiceBaseImpl;
24  import com.liferay.portlet.journal.service.permission.JournalStructurePermission;
25  
26  /**
27   * <a href="JournalStructureServiceImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class JournalStructureServiceImpl
32      extends JournalStructureServiceBaseImpl {
33  
34      public JournalStructure addStructure(
35              String structureId, boolean autoStructureId, long plid, String name,
36              String description, String xsd, boolean addCommunityPermissions,
37              boolean addGuestPermissions)
38          throws PortalException, SystemException {
39  
40          PortletPermissionUtil.check(
41              getPermissionChecker(), plid, PortletKeys.JOURNAL,
42              ActionKeys.ADD_STRUCTURE);
43  
44          return journalStructureLocalService.addStructure(
45              getUserId(), structureId, autoStructureId, plid, name, description,
46              xsd, addCommunityPermissions, addGuestPermissions);
47      }
48  
49      public JournalStructure addStructure(
50              String structureId, boolean autoStructureId, long plid, String name,
51              String description, String xsd, String[] communityPermissions,
52              String[] guestPermissions)
53          throws PortalException, SystemException {
54  
55          PortletPermissionUtil.check(
56              getPermissionChecker(), plid, PortletKeys.JOURNAL,
57              ActionKeys.ADD_STRUCTURE);
58  
59          return journalStructureLocalService.addStructure(
60              getUserId(), structureId, autoStructureId, plid, name, description,
61              xsd, communityPermissions, guestPermissions);
62      }
63  
64      public JournalStructure copyStructure(
65              long groupId, String oldStructureId, String newStructureId,
66              boolean autoStructureId)
67          throws PortalException, SystemException {
68  
69          JournalStructurePermission.check(
70              getPermissionChecker(), groupId, oldStructureId,
71              ActionKeys.ADD_STRUCTURE);
72  
73          return journalStructureLocalService.copyStructure(
74              getUserId(), groupId, oldStructureId, newStructureId,
75              autoStructureId);
76      }
77  
78      public void deleteStructure(long groupId, String structureId)
79          throws PortalException, SystemException {
80  
81          JournalStructurePermission.check(
82              getPermissionChecker(), groupId, structureId, ActionKeys.DELETE);
83  
84          journalStructureLocalService.deleteStructure(groupId, structureId);
85      }
86  
87      public JournalStructure getStructure(long groupId, String structureId)
88          throws PortalException, SystemException {
89  
90          JournalStructurePermission.check(
91              getPermissionChecker(), groupId, structureId, ActionKeys.VIEW);
92  
93          return journalStructureLocalService.getStructure(groupId, structureId);
94      }
95  
96      public JournalStructure updateStructure(
97              long groupId, String structureId, String name, String description,
98              String xsd)
99          throws PortalException, SystemException {
100 
101         JournalStructurePermission.check(
102             getPermissionChecker(), groupId, structureId, ActionKeys.UPDATE);
103 
104         return journalStructureLocalService.updateStructure(
105             groupId, structureId, name, description, xsd);
106     }
107 
108 }