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.ServiceContext;
21  import com.liferay.portlet.journal.model.JournalStructure;
22  import com.liferay.portlet.journal.service.base.JournalStructureServiceBaseImpl;
23  import com.liferay.portlet.journal.service.permission.JournalPermission;
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   * @author Raymond Augé
31   */
32  public class JournalStructureServiceImpl
33      extends JournalStructureServiceBaseImpl {
34  
35      public JournalStructure addStructure(
36              long groupId, String structureId, boolean autoStructureId,
37              String parentStructureId, String name, String description,
38              String xsd, ServiceContext serviceContext)
39          throws PortalException, SystemException {
40  
41          JournalPermission.check(
42              getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
43  
44          return journalStructureLocalService.addStructure(
45              getUserId(), groupId, structureId, autoStructureId,
46              parentStructureId, name, description, xsd, serviceContext);
47      }
48  
49      public JournalStructure copyStructure(
50              long groupId, String oldStructureId, String newStructureId,
51              boolean autoStructureId)
52          throws PortalException, SystemException {
53  
54          JournalPermission.check(
55              getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
56  
57          return journalStructureLocalService.copyStructure(
58              getUserId(), groupId, oldStructureId, newStructureId,
59              autoStructureId);
60      }
61  
62      public void deleteStructure(long groupId, String structureId)
63          throws PortalException, SystemException {
64  
65          JournalStructurePermission.check(
66              getPermissionChecker(), groupId, structureId, ActionKeys.DELETE);
67  
68          journalStructureLocalService.deleteStructure(groupId, structureId);
69      }
70  
71      public JournalStructure getStructure(long groupId, String structureId)
72          throws PortalException, SystemException {
73  
74          JournalStructurePermission.check(
75              getPermissionChecker(), groupId, structureId, ActionKeys.VIEW);
76  
77          return journalStructureLocalService.getStructure(groupId, structureId);
78      }
79  
80      public JournalStructure updateStructure(
81              long groupId, String structureId, String parentStructureId,
82              String name, String description, String xsd,
83              ServiceContext serviceContext)
84          throws PortalException, SystemException {
85  
86          JournalStructurePermission.check(
87              getPermissionChecker(), groupId, structureId, ActionKeys.UPDATE);
88  
89          return journalStructureLocalService.updateStructure(
90              groupId, structureId, parentStructureId, name, description, xsd,
91              serviceContext);
92      }
93  
94  }