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.SCProductEntry;
23  import com.liferay.portlet.softwarecatalog.service.base.SCProductEntryServiceBaseImpl;
24  import com.liferay.portlet.softwarecatalog.service.permission.SCProductEntryPermission;
25  
26  import java.util.List;
27  
28  /**
29   * <a href="SCProductEntryServiceImpl.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Jorge Ferrer
32   * @author Brian Wing Shun Chan
33   */
34  public class SCProductEntryServiceImpl extends SCProductEntryServiceBaseImpl {
35  
36      public SCProductEntry addProductEntry(
37              long plid, String name, String type, String tags,
38              String shortDescription, String longDescription, String pageURL,
39              String author, String repoGroupId, String repoArtifactId,
40              long[] licenseIds, List<byte[]> thumbnails, List<byte[]> fullImages,
41              boolean addCommunityPermissions, boolean addGuestPermissions)
42          throws PortalException, SystemException {
43  
44          PortletPermissionUtil.check(
45              getPermissionChecker(), plid, PortletKeys.SOFTWARE_CATALOG,
46              ActionKeys.ADD_PRODUCT_ENTRY);
47  
48          return scProductEntryLocalService.addProductEntry(
49              getUserId(), plid, name, type, tags, shortDescription,
50              longDescription, pageURL, author, repoGroupId, repoArtifactId,
51              licenseIds, thumbnails, fullImages, addCommunityPermissions,
52              addGuestPermissions);
53      }
54  
55      public SCProductEntry addProductEntry(
56              long plid, String name, String type, String tags,
57              String shortDescription, String longDescription, String pageURL,
58              String author, String repoGroupId, String repoArtifactId,
59              long[] licenseIds, List<byte[]> thumbnails, List<byte[]> fullImages,
60              String[] communityPermissions, String[] guestPermissions)
61          throws PortalException, SystemException {
62  
63          PortletPermissionUtil.check(
64              getPermissionChecker(), plid, PortletKeys.SOFTWARE_CATALOG,
65              ActionKeys.ADD_PRODUCT_ENTRY);
66  
67          return scProductEntryLocalService.addProductEntry(
68              getUserId(), plid, name, type, tags, shortDescription,
69              longDescription, pageURL, author, repoGroupId, repoArtifactId,
70              licenseIds, thumbnails, fullImages, communityPermissions,
71              guestPermissions);
72      }
73  
74      public void deleteProductEntry(long productEntryId)
75          throws PortalException, SystemException {
76  
77          SCProductEntryPermission.check(
78              getPermissionChecker(), productEntryId, ActionKeys.DELETE);
79  
80          scProductEntryLocalService.deleteProductEntry(productEntryId);
81      }
82  
83      public SCProductEntry getProductEntry(long productEntryId)
84          throws PortalException, SystemException {
85  
86          SCProductEntryPermission.check(
87              getPermissionChecker(), productEntryId, ActionKeys.VIEW);
88  
89          return scProductEntryLocalService.getProductEntry(productEntryId);
90      }
91  
92      public SCProductEntry updateProductEntry(
93              long productEntryId, String name, String type, String tags,
94              String shortDescription, String longDescription, String pageURL,
95              String author, String repoGroupId, String repoArtifactId,
96              long[] licenseIds, List<byte[]> thumbnails, List<byte[]> fullImages)
97          throws PortalException, SystemException {
98  
99          SCProductEntryPermission.check(
100             getPermissionChecker(), productEntryId, ActionKeys.UPDATE);
101 
102         return scProductEntryLocalService.updateProductEntry(
103             productEntryId, name, type, tags, shortDescription, longDescription,
104             pageURL, author, repoGroupId, repoArtifactId, licenseIds,
105             thumbnails, fullImages);
106     }
107 
108 }