1
14
15 package com.liferay.portlet.softwarecatalog.service.impl;
16
17 import com.liferay.portal.PortalException;
18 import com.liferay.portal.SystemException;
19 import com.liferay.portal.security.permission.ActionKeys;
20 import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
21 import com.liferay.portlet.softwarecatalog.service.base.SCProductVersionServiceBaseImpl;
22 import com.liferay.portlet.softwarecatalog.service.permission.SCProductEntryPermission;
23
24 import java.util.List;
25
26
32 public class SCProductVersionServiceImpl
33 extends SCProductVersionServiceBaseImpl {
34
35 public SCProductVersion addProductVersion(
36 long productEntryId, String version, String changeLog,
37 String downloadPageURL, String directDownloadURL,
38 boolean testDirectDownloadURL, boolean repoStoreArtifact,
39 long[] frameworkVersionIds, boolean addCommunityPermissions,
40 boolean addGuestPermissions)
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, addCommunityPermissions, addGuestPermissions);
50 }
51
52 public SCProductVersion addProductVersion(
53 long productEntryId, String version, String changeLog,
54 String downloadPageURL, String directDownloadURL,
55 boolean testDirectDownloadURL, boolean repoStoreArtifact,
56 long[] frameworkVersionIds, String[] communityPermissions,
57 String[] guestPermissions)
58 throws PortalException, SystemException {
59
60 SCProductEntryPermission.check(
61 getPermissionChecker(), productEntryId, ActionKeys.UPDATE);
62
63 return scProductVersionLocalService.addProductVersion(
64 getUserId(), productEntryId, version, changeLog, downloadPageURL,
65 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
66 frameworkVersionIds, communityPermissions, guestPermissions);
67 }
68
69 public void deleteProductVersion(long productVersionId)
70 throws PortalException, SystemException {
71
72 SCProductVersion productVersion =
73 scProductVersionLocalService.getProductVersion(productVersionId);
74
75 SCProductEntryPermission.check(
76 getPermissionChecker(), productVersion.getProductEntryId(),
77 ActionKeys.UPDATE);
78
79 scProductVersionLocalService.deleteProductVersion(productVersionId);
80 }
81
82 public SCProductVersion getProductVersion(long productVersionId)
83 throws PortalException, SystemException {
84
85 SCProductVersion productVersion =
86 scProductVersionLocalService.getProductVersion(productVersionId);
87
88 SCProductEntryPermission.check(
89 getPermissionChecker(), productVersion.getProductEntryId(),
90 ActionKeys.VIEW);
91
92 return productVersion;
93 }
94
95 public List<SCProductVersion> getProductVersions(
96 long productEntryId, int start, int end)
97 throws SystemException, PortalException {
98
99 SCProductEntryPermission.check(
100 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
101
102 return scProductVersionLocalService.getProductVersions(
103 productEntryId, start, end);
104 }
105
106 public int getProductVersionsCount(long productEntryId)
107 throws SystemException, PortalException {
108
109 SCProductEntryPermission.check(
110 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
111
112 return scProductVersionLocalService.getProductVersionsCount(
113 productEntryId);
114 }
115
116 public SCProductVersion updateProductVersion(
117 long productVersionId, String version, String changeLog,
118 String downloadPageURL, String directDownloadURL,
119 boolean testDirectDownloadURL, boolean repoStoreArtifact,
120 long[] frameworkVersionIds)
121 throws PortalException, SystemException {
122
123 SCProductVersion productVersion =
124 scProductVersionLocalService.getProductVersion(productVersionId);
125
126 SCProductEntryPermission.check(
127 getPermissionChecker(), productVersion.getProductEntryId(),
128 ActionKeys.UPDATE);
129
130 return scProductVersionLocalService.updateProductVersion(
131 productVersionId, version, changeLog, downloadPageURL,
132 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
133 frameworkVersionIds);
134 }
135
136 }