1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.service.impl;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.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  }