001
014
015 package com.liferay.portlet.softwarecatalog.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.security.permission.ActionKeys;
020 import com.liferay.portal.service.ServiceContext;
021 import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
022 import com.liferay.portlet.softwarecatalog.service.base.SCProductVersionServiceBaseImpl;
023 import com.liferay.portlet.softwarecatalog.service.permission.SCProductEntryPermission;
024
025 import java.util.List;
026
027
031 public class SCProductVersionServiceImpl
032 extends SCProductVersionServiceBaseImpl {
033
034 public SCProductVersion addProductVersion(
035 long productEntryId, String version, String changeLog,
036 String downloadPageURL, String directDownloadURL,
037 boolean testDirectDownloadURL, boolean repoStoreArtifact,
038 long[] frameworkVersionIds, ServiceContext serviceContext)
039 throws PortalException, SystemException {
040
041 SCProductEntryPermission.check(
042 getPermissionChecker(), productEntryId, ActionKeys.UPDATE);
043
044 return scProductVersionLocalService.addProductVersion(
045 getUserId(), productEntryId, version, changeLog, downloadPageURL,
046 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
047 frameworkVersionIds, serviceContext);
048 }
049
050 public void deleteProductVersion(long productVersionId)
051 throws PortalException, SystemException {
052
053 SCProductVersion productVersion =
054 scProductVersionLocalService.getProductVersion(productVersionId);
055
056 SCProductEntryPermission.check(
057 getPermissionChecker(), productVersion.getProductEntryId(),
058 ActionKeys.UPDATE);
059
060 scProductVersionLocalService.deleteProductVersion(productVersionId);
061 }
062
063 public SCProductVersion getProductVersion(long productVersionId)
064 throws PortalException, SystemException {
065
066 SCProductVersion productVersion =
067 scProductVersionLocalService.getProductVersion(productVersionId);
068
069 SCProductEntryPermission.check(
070 getPermissionChecker(), productVersion.getProductEntryId(),
071 ActionKeys.VIEW);
072
073 return productVersion;
074 }
075
076 public List<SCProductVersion> getProductVersions(
077 long productEntryId, int start, int end)
078 throws SystemException, PortalException {
079
080 SCProductEntryPermission.check(
081 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
082
083 return scProductVersionLocalService.getProductVersions(
084 productEntryId, start, end);
085 }
086
087 public int getProductVersionsCount(long productEntryId)
088 throws SystemException, PortalException {
089
090 SCProductEntryPermission.check(
091 getPermissionChecker(), productEntryId, ActionKeys.VIEW);
092
093 return scProductVersionLocalService.getProductVersionsCount(
094 productEntryId);
095 }
096
097 public SCProductVersion updateProductVersion(
098 long productVersionId, String version, String changeLog,
099 String downloadPageURL, String directDownloadURL,
100 boolean testDirectDownloadURL, boolean repoStoreArtifact,
101 long[] frameworkVersionIds)
102 throws PortalException, SystemException {
103
104 SCProductVersion productVersion =
105 scProductVersionLocalService.getProductVersion(productVersionId);
106
107 SCProductEntryPermission.check(
108 getPermissionChecker(), productVersion.getProductEntryId(),
109 ActionKeys.UPDATE);
110
111 return scProductVersionLocalService.updateProductVersion(
112 productVersionId, version, changeLog, downloadPageURL,
113 directDownloadURL, testDirectDownloadURL, repoStoreArtifact,
114 frameworkVersionIds);
115 }
116
117 }