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.portlet.softwarecatalog.model.SCProductVersion;
29 import com.liferay.portlet.softwarecatalog.service.base.SCProductVersionServiceBaseImpl;
30 import com.liferay.portlet.softwarecatalog.service.permission.SCProductEntryPermission;
31
32 import java.util.List;
33
34
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, boolean addCommunityPermissions,
49 boolean addGuestPermissions)
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, addCommunityPermissions, addGuestPermissions);
59 }
60
61 public SCProductVersion addProductVersion(
62 long productEntryId, String version, String changeLog,
63 String downloadPageURL, String directDownloadURL,
64 boolean testDirectDownloadURL, boolean repoStoreArtifact,
65 long[] frameworkVersionIds, String[] communityPermissions,
66 String[] guestPermissions)
67 throws PortalException, SystemException {
68
69 SCProductEntryPermission.check(
70 getPermissionChecker(), productEntryId, ActionKeys.UPDATE);
71
72 return scProductVersionLocalService.addProductVersion(
73 getUserId(), productEntryId, version, changeLog, downloadPageURL,
74 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
75 frameworkVersionIds, communityPermissions, guestPermissions);
76 }
77
78 public void deleteProductVersion(long productVersionId)
79 throws PortalException, SystemException {
80
81 SCProductVersion productVersion =
82 scProductVersionLocalService.getProductVersion(productVersionId);
83
84 SCProductEntryPermission.check(
85 getPermissionChecker(), productVersion.getProductEntryId(),
86 ActionKeys.UPDATE);
87
88 scProductVersionLocalService.deleteProductVersion(productVersionId);
89 }
90
91 public SCProductVersion getProductVersion(long productVersionId)
92 throws PortalException, SystemException {
93
94 SCProductVersion productVersion =
95 scProductVersionLocalService.getProductVersion(productVersionId);
96
97 SCProductEntryPermission.check(
98 getPermissionChecker(), productVersion.getProductEntryId(),
99 ActionKeys.VIEW);
100
101 return productVersion;
102 }
103
104 public List<SCProductVersion> getProductVersions(
105 long productEntryId, int start, int end)
106 throws SystemException, PortalException {
107
108 SCProductEntryPermission.check(
109 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
110
111 return scProductVersionLocalService.getProductVersions(
112 productEntryId, start, end);
113 }
114
115 public int getProductVersionsCount(long productEntryId)
116 throws SystemException, PortalException {
117
118 SCProductEntryPermission.check(
119 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
120
121 return scProductVersionLocalService.getProductVersionsCount(
122 productEntryId);
123 }
124
125 public SCProductVersion updateProductVersion(
126 long productVersionId, String version, String changeLog,
127 String downloadPageURL, String directDownloadURL,
128 boolean testDirectDownloadURL, boolean repoStoreArtifact,
129 long[] frameworkVersionIds)
130 throws PortalException, SystemException {
131
132 SCProductVersion productVersion =
133 scProductVersionLocalService.getProductVersion(productVersionId);
134
135 SCProductEntryPermission.check(
136 getPermissionChecker(), productVersion.getProductEntryId(),
137 ActionKeys.UPDATE);
138
139 return scProductVersionLocalService.updateProductVersion(
140 productVersionId, version, changeLog, downloadPageURL,
141 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
142 frameworkVersionIds);
143 }
144
145 }