1
14
15 package com.liferay.portlet.softwarecatalog.service.impl;
16
17 import com.liferay.portal.kernel.exception.PortalException;
18 import com.liferay.portal.kernel.exception.SystemException;
19 import com.liferay.portal.security.permission.ActionKeys;
20 import com.liferay.portal.service.ServiceContext;
21 import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
22 import com.liferay.portlet.softwarecatalog.service.base.SCProductVersionServiceBaseImpl;
23 import com.liferay.portlet.softwarecatalog.service.permission.SCProductEntryPermission;
24
25 import java.util.List;
26
27
33 public class SCProductVersionServiceImpl
34 extends SCProductVersionServiceBaseImpl {
35
36 public SCProductVersion addProductVersion(
37 long productEntryId, String version, String changeLog,
38 String downloadPageURL, String directDownloadURL,
39 boolean testDirectDownloadURL, boolean repoStoreArtifact,
40 long[] frameworkVersionIds, ServiceContext serviceContext)
41 throws PortalException, SystemException {
42
43 SCProductEntryPermission.check(
44 getPermissionChecker(), productEntryId, ActionKeys.UPDATE);
45
46 return scProductVersionLocalService.addProductVersion(
47 getUserId(), productEntryId, version, changeLog, downloadPageURL,
48 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
49 frameworkVersionIds, serviceContext);
50 }
51
52 public void deleteProductVersion(long productVersionId)
53 throws PortalException, SystemException {
54
55 SCProductVersion productVersion =
56 scProductVersionLocalService.getProductVersion(productVersionId);
57
58 SCProductEntryPermission.check(
59 getPermissionChecker(), productVersion.getProductEntryId(),
60 ActionKeys.UPDATE);
61
62 scProductVersionLocalService.deleteProductVersion(productVersionId);
63 }
64
65 public SCProductVersion getProductVersion(long productVersionId)
66 throws PortalException, SystemException {
67
68 SCProductVersion productVersion =
69 scProductVersionLocalService.getProductVersion(productVersionId);
70
71 SCProductEntryPermission.check(
72 getPermissionChecker(), productVersion.getProductEntryId(),
73 ActionKeys.VIEW);
74
75 return productVersion;
76 }
77
78 public List<SCProductVersion> getProductVersions(
79 long productEntryId, int start, int end)
80 throws SystemException, PortalException {
81
82 SCProductEntryPermission.check(
83 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
84
85 return scProductVersionLocalService.getProductVersions(
86 productEntryId, start, end);
87 }
88
89 public int getProductVersionsCount(long productEntryId)
90 throws SystemException, PortalException {
91
92 SCProductEntryPermission.check(
93 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
94
95 return scProductVersionLocalService.getProductVersionsCount(
96 productEntryId);
97 }
98
99 public SCProductVersion updateProductVersion(
100 long productVersionId, String version, String changeLog,
101 String downloadPageURL, String directDownloadURL,
102 boolean testDirectDownloadURL, boolean repoStoreArtifact,
103 long[] frameworkVersionIds)
104 throws PortalException, SystemException {
105
106 SCProductVersion productVersion =
107 scProductVersionLocalService.getProductVersion(productVersionId);
108
109 SCProductEntryPermission.check(
110 getPermissionChecker(), productVersion.getProductEntryId(),
111 ActionKeys.UPDATE);
112
113 return scProductVersionLocalService.updateProductVersion(
114 productVersionId, version, changeLog, downloadPageURL,
115 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
116 frameworkVersionIds);
117 }
118
119 }