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 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<SCProductVersion> getProductVersions(
103 long productEntryId, int start, int end)
104 throws SystemException, PortalException {
105
106 SCProductEntryPermission.check(
107 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
108
109 return scProductVersionLocalService.getProductVersions(
110 productEntryId, start, end);
111 }
112
113 public int getProductVersionsCount(long productEntryId)
114 throws SystemException, PortalException {
115
116 SCProductEntryPermission.check(
117 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
118
119 return scProductVersionLocalService.getProductVersionsCount(
120 productEntryId);
121 }
122
123 public SCProductVersion updateProductVersion(
124 long productVersionId, String version, String changeLog,
125 String downloadPageURL, String directDownloadURL,
126 boolean repoStoreArtifact, long[] frameworkVersionIds)
127 throws PortalException, SystemException {
128
129 SCProductVersion productVersion =
130 scProductVersionLocalService.getProductVersion(productVersionId);
131
132 SCProductEntryPermission.check(
133 getPermissionChecker(), productVersion.getProductEntryId(),
134 ActionKeys.UPDATE);
135
136 return scProductVersionLocalService.updateProductVersion(
137 productVersionId, version, changeLog, downloadPageURL,
138 directDownloadURL, repoStoreArtifact, frameworkVersionIds);
139 }
140
141 }