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