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.softwarecatalog.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.softwarecatalog.model.SCFrameworkVersion;
23  import com.liferay.portlet.softwarecatalog.service.base.SCFrameworkVersionServiceBaseImpl;
24  import com.liferay.portlet.softwarecatalog.service.permission.SCFrameworkVersionPermission;
25  
26  import java.util.List;
27  
28  /**
29   * <a href="SCFrameworkVersionServiceImpl.java.html"><b><i>View Source</i></b>
30   * </a>
31   *
32   * @author Jorge Ferrer
33   * @author Brian Wing Shun Chan
34   */
35  public class SCFrameworkVersionServiceImpl
36      extends SCFrameworkVersionServiceBaseImpl {
37  
38      public SCFrameworkVersion addFrameworkVersion(
39              long plid, String name, String url, boolean active, int priority,
40              boolean addCommunityPermissions, boolean addGuestPermissions)
41          throws PortalException, SystemException {
42  
43          PortletPermissionUtil.check(
44              getPermissionChecker(), plid, PortletKeys.SOFTWARE_CATALOG,
45              ActionKeys.ADD_FRAMEWORK_VERSION);
46  
47          return scFrameworkVersionLocalService.addFrameworkVersion(
48              getUserId(), plid, name, url, active, priority,
49              addCommunityPermissions, addGuestPermissions);
50      }
51  
52      public SCFrameworkVersion addFrameworkVersion(
53              long plid, String name, String url, boolean active, int priority,
54              String[] communityPermissions, String[] guestPermissions)
55          throws PortalException, SystemException {
56  
57          PortletPermissionUtil.check(
58              getPermissionChecker(), plid, PortletKeys.SOFTWARE_CATALOG,
59              ActionKeys.ADD_FRAMEWORK_VERSION);
60  
61          return scFrameworkVersionLocalService.addFrameworkVersion(
62              getUserId(), plid, name, url, active, priority,
63              communityPermissions, guestPermissions);
64      }
65  
66      public void deleteFrameworkVersion(long frameworkVersionId)
67          throws PortalException, SystemException {
68  
69          SCFrameworkVersionPermission.check(
70              getPermissionChecker(), frameworkVersionId, ActionKeys.DELETE);
71  
72          scFrameworkVersionLocalService.deleteFrameworkVersion(
73              frameworkVersionId);
74      }
75  
76      public SCFrameworkVersion getFrameworkVersion(long frameworkVersionId)
77          throws PortalException, SystemException {
78  
79          return scFrameworkVersionLocalService.getFrameworkVersion(
80              frameworkVersionId);
81      }
82  
83      public List<SCFrameworkVersion> getFrameworkVersions(
84              long groupId, boolean active)
85          throws SystemException {
86  
87          return scFrameworkVersionLocalService.getFrameworkVersions(
88              groupId, active);
89      }
90  
91      public List<SCFrameworkVersion> getFrameworkVersions(
92              long groupId, boolean active, int start, int end)
93          throws SystemException {
94  
95          return scFrameworkVersionLocalService.getFrameworkVersions(
96              groupId, active, start, end);
97      }
98  
99      public SCFrameworkVersion updateFrameworkVersion(
100             long frameworkVersionId, String name, String url, boolean active,
101             int priority)
102         throws PortalException, SystemException {
103 
104         SCFrameworkVersionPermission.check(
105             getPermissionChecker(), frameworkVersionId, ActionKeys.UPDATE);
106 
107         return scFrameworkVersionLocalService.updateFrameworkVersion(
108             frameworkVersionId, name, url, active, priority);
109     }
110 
111 }