1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.journal.service.impl;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.security.permission.ActionKeys;
28  import com.liferay.portal.service.ServiceContext;
29  import com.liferay.portlet.journal.model.JournalStructure;
30  import com.liferay.portlet.journal.service.base.JournalStructureServiceBaseImpl;
31  import com.liferay.portlet.journal.service.permission.JournalPermission;
32  import com.liferay.portlet.journal.service.permission.JournalStructurePermission;
33  
34  /**
35   * <a href="JournalStructureServiceImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   * @author Raymond Augé
39   */
40  public class JournalStructureServiceImpl
41      extends JournalStructureServiceBaseImpl {
42  
43      public JournalStructure addStructure(
44              long groupId, String structureId, boolean autoStructureId,
45              String parentStructureId, String name, String description,
46              String xsd, ServiceContext serviceContext)
47          throws PortalException, SystemException {
48  
49          JournalPermission.check(
50              getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
51  
52          return journalStructureLocalService.addStructure(
53              getUserId(), groupId, structureId, autoStructureId,
54              parentStructureId, name, description, xsd, serviceContext);
55      }
56  
57      public JournalStructure copyStructure(
58              long groupId, String oldStructureId, String newStructureId,
59              boolean autoStructureId)
60          throws PortalException, SystemException {
61  
62          JournalPermission.check(
63              getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
64  
65          return journalStructureLocalService.copyStructure(
66              getUserId(), groupId, oldStructureId, newStructureId,
67              autoStructureId);
68      }
69  
70      public void deleteStructure(long groupId, String structureId)
71          throws PortalException, SystemException {
72  
73          JournalStructurePermission.check(
74              getPermissionChecker(), groupId, structureId, ActionKeys.DELETE);
75  
76          journalStructureLocalService.deleteStructure(groupId, structureId);
77      }
78  
79      public JournalStructure getStructure(long groupId, String structureId)
80          throws PortalException, SystemException {
81  
82          JournalStructurePermission.check(
83              getPermissionChecker(), groupId, structureId, ActionKeys.VIEW);
84  
85          return journalStructureLocalService.getStructure(groupId, structureId);
86      }
87  
88      public JournalStructure updateStructure(
89              long groupId, String structureId, String parentStructureId,
90              String name, String description, String xsd,
91              ServiceContext serviceContext)
92          throws PortalException, SystemException {
93  
94          JournalStructurePermission.check(
95              getPermissionChecker(), groupId, structureId, ActionKeys.UPDATE);
96  
97          return journalStructureLocalService.updateStructure(
98              groupId, structureId, parentStructureId, name, description, xsd,
99              serviceContext);
100     }
101 
102 }