1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.softwarecatalog.service.impl;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.security.permission.ActionKeys;
28  import com.liferay.portal.service.impl.PrincipalBean;
29  import com.liferay.portal.service.permission.PortletPermissionUtil;
30  import com.liferay.portal.util.PortletKeys;
31  import com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion;
32  import com.liferay.portlet.softwarecatalog.service.SCFrameworkVersionLocalServiceUtil;
33  import com.liferay.portlet.softwarecatalog.service.SCFrameworkVersionService;
34  import com.liferay.portlet.softwarecatalog.service.permission.SCFrameworkVersionPermission;
35  
36  import java.util.List;
37  
38  /**
39   * <a href="SCFrameworkVersionServiceImpl.java.html"><b><i>View Source</i></b>
40   * </a>
41   *
42   * @author Jorge Ferrer
43   * @author Brian Wing Shun Chan
44   *
45   */
46  public class SCFrameworkVersionServiceImpl
47      extends PrincipalBean implements SCFrameworkVersionService {
48  
49      public SCFrameworkVersion addFrameworkVersion(
50              long plid, String name, String url, boolean active, int priority,
51              boolean addCommunityPermissions, boolean addGuestPermissions)
52          throws PortalException, SystemException {
53  
54          PortletPermissionUtil.check(
55              getPermissionChecker(), plid, PortletKeys.SOFTWARE_CATALOG,
56              ActionKeys.ADD_FRAMEWORK_VERSION);
57  
58          return SCFrameworkVersionLocalServiceUtil.addFrameworkVersion(
59              getUserId(), plid, name, url, active, priority,
60              addCommunityPermissions, addGuestPermissions);
61      }
62  
63      public SCFrameworkVersion addFrameworkVersion(
64              long plid, String name, String url, boolean active, int priority,
65              String[] communityPermissions, String[] guestPermissions)
66          throws PortalException, SystemException {
67  
68          PortletPermissionUtil.check(
69              getPermissionChecker(), plid, PortletKeys.SOFTWARE_CATALOG,
70              ActionKeys.ADD_FRAMEWORK_VERSION);
71  
72          return SCFrameworkVersionLocalServiceUtil.addFrameworkVersion(
73              getUserId(), plid, name, url, active, priority,
74              communityPermissions, guestPermissions);
75      }
76  
77      public void deleteFrameworkVersion(long frameworkVersionId)
78          throws PortalException, SystemException {
79  
80          SCFrameworkVersionPermission.check(
81              getPermissionChecker(), frameworkVersionId, ActionKeys.DELETE);
82  
83          SCFrameworkVersionLocalServiceUtil.deleteFrameworkVersion(
84              frameworkVersionId);
85      }
86  
87      public SCFrameworkVersion getFrameworkVersion(long frameworkVersionId)
88          throws PortalException, SystemException {
89  
90          return SCFrameworkVersionLocalServiceUtil.getFrameworkVersion(
91              frameworkVersionId);
92      }
93  
94      public List getFrameworkVersions(long groupId, boolean active)
95          throws SystemException {
96  
97          return SCFrameworkVersionLocalServiceUtil.getFrameworkVersions(
98              groupId, active);
99      }
100 
101     public List getFrameworkVersions(
102             long groupId, boolean active, int begin, int end)
103         throws SystemException {
104 
105         return SCFrameworkVersionLocalServiceUtil.getFrameworkVersions(
106             groupId, active, begin, end);
107     }
108 
109     public SCFrameworkVersion updateFrameworkVersion(
110             long frameworkVersionId, String name, String url, boolean active,
111             int priority)
112         throws PortalException, SystemException {
113 
114         SCFrameworkVersionPermission.check(
115             getPermissionChecker(), frameworkVersionId, ActionKeys.UPDATE);
116 
117         return SCFrameworkVersionLocalServiceUtil.updateFrameworkVersion(
118             frameworkVersionId, name, url, active, priority);
119     }
120 
121 }