1
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.ServiceContext;
29 import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
30 import com.liferay.portlet.softwarecatalog.service.base.SCProductVersionServiceBaseImpl;
31 import com.liferay.portlet.softwarecatalog.service.permission.SCProductEntryPermission;
32
33 import java.util.List;
34
35
41 public class SCProductVersionServiceImpl
42 extends SCProductVersionServiceBaseImpl {
43
44 public SCProductVersion addProductVersion(
45 long productEntryId, String version, String changeLog,
46 String downloadPageURL, String directDownloadURL,
47 boolean testDirectDownloadURL, boolean repoStoreArtifact,
48 long[] frameworkVersionIds, ServiceContext serviceContext)
49 throws PortalException, SystemException {
50
51 SCProductEntryPermission.check(
52 getPermissionChecker(), productEntryId, ActionKeys.UPDATE);
53
54 return scProductVersionLocalService.addProductVersion(
55 getUserId(), productEntryId, version, changeLog, downloadPageURL,
56 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
57 frameworkVersionIds, serviceContext);
58 }
59
60 public void deleteProductVersion(long productVersionId)
61 throws PortalException, SystemException {
62
63 SCProductVersion productVersion =
64 scProductVersionLocalService.getProductVersion(productVersionId);
65
66 SCProductEntryPermission.check(
67 getPermissionChecker(), productVersion.getProductEntryId(),
68 ActionKeys.UPDATE);
69
70 scProductVersionLocalService.deleteProductVersion(productVersionId);
71 }
72
73 public SCProductVersion getProductVersion(long productVersionId)
74 throws PortalException, SystemException {
75
76 SCProductVersion productVersion =
77 scProductVersionLocalService.getProductVersion(productVersionId);
78
79 SCProductEntryPermission.check(
80 getPermissionChecker(), productVersion.getProductEntryId(),
81 ActionKeys.VIEW);
82
83 return productVersion;
84 }
85
86 public List<SCProductVersion> getProductVersions(
87 long productEntryId, int start, int end)
88 throws SystemException, PortalException {
89
90 SCProductEntryPermission.check(
91 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
92
93 return scProductVersionLocalService.getProductVersions(
94 productEntryId, start, end);
95 }
96
97 public int getProductVersionsCount(long productEntryId)
98 throws SystemException, PortalException {
99
100 SCProductEntryPermission.check(
101 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
102
103 return scProductVersionLocalService.getProductVersionsCount(
104 productEntryId);
105 }
106
107 public SCProductVersion updateProductVersion(
108 long productVersionId, String version, String changeLog,
109 String downloadPageURL, String directDownloadURL,
110 boolean testDirectDownloadURL, boolean repoStoreArtifact,
111 long[] frameworkVersionIds)
112 throws PortalException, SystemException {
113
114 SCProductVersion productVersion =
115 scProductVersionLocalService.getProductVersion(productVersionId);
116
117 SCProductEntryPermission.check(
118 getPermissionChecker(), productVersion.getProductEntryId(),
119 ActionKeys.UPDATE);
120
121 return scProductVersionLocalService.updateProductVersion(
122 productVersionId, version, changeLog, downloadPageURL,
123 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
124 frameworkVersionIds);
125 }
126
127 }