1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.journal.service.impl;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.security.permission.ActionKeys;
25  import com.liferay.portal.service.ServiceContext;
26  import com.liferay.portlet.journal.model.JournalStructure;
27  import com.liferay.portlet.journal.service.base.JournalStructureServiceBaseImpl;
28  import com.liferay.portlet.journal.service.permission.JournalPermission;
29  import com.liferay.portlet.journal.service.permission.JournalStructurePermission;
30  
31  /**
32   * <a href="JournalStructureServiceImpl.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Brian Wing Shun Chan
35   * @author Raymond Augé
36   *
37   */
38  public class JournalStructureServiceImpl
39      extends JournalStructureServiceBaseImpl {
40  
41      public JournalStructure addStructure(
42              long groupId, String structureId, boolean autoStructureId,
43              String parentStructureId, String name, String description,
44              String xsd, ServiceContext serviceContext)
45          throws PortalException, SystemException {
46  
47          JournalPermission.check(
48              getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
49  
50          return journalStructureLocalService.addStructure(
51              getUserId(), groupId, structureId, autoStructureId,
52              parentStructureId, name, description, xsd, serviceContext);
53      }
54  
55      public JournalStructure copyStructure(
56              long groupId, String oldStructureId, String newStructureId,
57              boolean autoStructureId)
58          throws PortalException, SystemException {
59  
60          JournalPermission.check(
61              getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
62  
63          return journalStructureLocalService.copyStructure(
64              getUserId(), groupId, oldStructureId, newStructureId,
65              autoStructureId);
66      }
67  
68      public void deleteStructure(long groupId, String structureId)
69          throws PortalException, SystemException {
70  
71          JournalStructurePermission.check(
72              getPermissionChecker(), groupId, structureId, ActionKeys.DELETE);
73  
74          journalStructureLocalService.deleteStructure(groupId, structureId);
75      }
76  
77      public JournalStructure getStructure(long groupId, String structureId)
78          throws PortalException, SystemException {
79  
80          JournalStructurePermission.check(
81              getPermissionChecker(), groupId, structureId, ActionKeys.VIEW);
82  
83          return journalStructureLocalService.getStructure(groupId, structureId);
84      }
85  
86      public JournalStructure updateStructure(
87              long groupId, String structureId, String parentStructureId,
88              String name, String description, String xsd,
89              ServiceContext serviceContext)
90          throws PortalException, SystemException {
91  
92          JournalStructurePermission.check(
93              getPermissionChecker(), groupId, structureId, ActionKeys.UPDATE);
94  
95          return journalStructureLocalService.updateStructure(
96              groupId, structureId, parentStructureId, name, description, xsd,
97              serviceContext);
98      }
99  
100 }