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