1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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.ServiceContext;
21  import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
22  import com.liferay.portlet.softwarecatalog.service.base.SCProductEntryServiceBaseImpl;
23  import com.liferay.portlet.softwarecatalog.service.permission.SCPermission;
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              String name, String type, String tags, String shortDescription,
38              String longDescription, String pageURL, String author,
39              String repoGroupId, String repoArtifactId, long[] licenseIds,
40              List<byte[]> thumbnails, List<byte[]> fullImages,
41              ServiceContext serviceContext)
42          throws PortalException, SystemException {
43  
44          SCPermission.check(
45              getPermissionChecker(), serviceContext.getScopeGroupId(),
46              ActionKeys.ADD_PRODUCT_ENTRY);
47  
48          return scProductEntryLocalService.addProductEntry(
49              getUserId(), name, type, tags, shortDescription,
50              longDescription, pageURL, author, repoGroupId, repoArtifactId,
51              licenseIds, thumbnails, fullImages, serviceContext);
52      }
53  
54      public void deleteProductEntry(long productEntryId)
55          throws PortalException, SystemException {
56  
57          SCProductEntryPermission.check(
58              getPermissionChecker(), productEntryId, ActionKeys.DELETE);
59  
60          scProductEntryLocalService.deleteProductEntry(productEntryId);
61      }
62  
63      public SCProductEntry getProductEntry(long productEntryId)
64          throws PortalException, SystemException {
65  
66          SCProductEntryPermission.check(
67              getPermissionChecker(), productEntryId, ActionKeys.VIEW);
68  
69          return scProductEntryLocalService.getProductEntry(productEntryId);
70      }
71  
72      public SCProductEntry updateProductEntry(
73              long productEntryId, String name, String type, String tags,
74              String shortDescription, String longDescription, String pageURL,
75              String author, String repoGroupId, String repoArtifactId,
76              long[] licenseIds, List<byte[]> thumbnails, List<byte[]> fullImages)
77          throws PortalException, SystemException {
78  
79          SCProductEntryPermission.check(
80              getPermissionChecker(), productEntryId, ActionKeys.UPDATE);
81  
82          return scProductEntryLocalService.updateProductEntry(
83              productEntryId, name, type, tags, shortDescription, longDescription,
84              pageURL, author, repoGroupId, repoArtifactId, licenseIds,
85              thumbnails, fullImages);
86      }
87  
88  }