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