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