001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.softwarecatalog.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.kernel.security.permission.ActionKeys;
026: import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
027: import com.liferay.portlet.softwarecatalog.service.base.SCProductVersionServiceBaseImpl;
028: import com.liferay.portlet.softwarecatalog.service.permission.SCProductEntryPermission;
029:
030: import java.util.List;
031:
032: /**
033: * <a href="SCProductVersionServiceImpl.java.html"><b><i>View Source</i></b></a>
034: *
035: * @author Jorge Ferrer
036: * @author Brian Wing Shun Chan
037: *
038: */
039: public class SCProductVersionServiceImpl extends
040: SCProductVersionServiceBaseImpl {
041:
042: public SCProductVersion addProductVersion(long productEntryId,
043: String version, String changeLog, String downloadPageURL,
044: String directDownloadURL, boolean repoStoreArtifact,
045: long[] frameworkVersionIds,
046: boolean addCommunityPermissions, boolean addGuestPermissions)
047: throws PortalException, SystemException {
048:
049: SCProductEntryPermission.check(getPermissionChecker(),
050: productEntryId, ActionKeys.UPDATE);
051:
052: return scProductVersionLocalService.addProductVersion(
053: getUserId(), productEntryId, version, changeLog,
054: downloadPageURL, directDownloadURL, repoStoreArtifact,
055: frameworkVersionIds, addCommunityPermissions,
056: addGuestPermissions);
057: }
058:
059: public SCProductVersion addProductVersion(long productEntryId,
060: String version, String changeLog, String downloadPageURL,
061: String directDownloadURL, boolean repoStoreArtifact,
062: long[] frameworkVersionIds, String[] communityPermissions,
063: String[] guestPermissions) throws PortalException,
064: SystemException {
065:
066: SCProductEntryPermission.check(getPermissionChecker(),
067: productEntryId, ActionKeys.UPDATE);
068:
069: return scProductVersionLocalService.addProductVersion(
070: getUserId(), productEntryId, version, changeLog,
071: downloadPageURL, directDownloadURL, repoStoreArtifact,
072: frameworkVersionIds, communityPermissions,
073: guestPermissions);
074: }
075:
076: public void deleteProductVersion(long productVersionId)
077: throws PortalException, SystemException {
078:
079: SCProductVersion productVersion = scProductVersionLocalService
080: .getProductVersion(productVersionId);
081:
082: SCProductEntryPermission.check(getPermissionChecker(),
083: productVersion.getProductEntryId(), ActionKeys.UPDATE);
084:
085: scProductVersionLocalService
086: .deleteProductVersion(productVersionId);
087: }
088:
089: public SCProductVersion getProductVersion(long productVersionId)
090: throws PortalException, SystemException {
091:
092: SCProductVersion productVersion = scProductVersionLocalService
093: .getProductVersion(productVersionId);
094:
095: SCProductEntryPermission.check(getPermissionChecker(),
096: productVersion.getProductEntryId(), ActionKeys.VIEW);
097:
098: return productVersion;
099: }
100:
101: public List getProductVersions(long productEntryId, int begin,
102: int end) throws SystemException, PortalException {
103:
104: SCProductEntryPermission.check(getPermissionChecker(),
105: productEntryId, ActionKeys.VIEW);
106:
107: return scProductVersionLocalService.getProductVersions(
108: productEntryId, begin, end);
109: }
110:
111: public int getProductVersionsCount(long productEntryId)
112: throws SystemException, PortalException {
113:
114: SCProductEntryPermission.check(getPermissionChecker(),
115: productEntryId, ActionKeys.VIEW);
116:
117: return scProductVersionLocalService
118: .getProductVersionsCount(productEntryId);
119: }
120:
121: public SCProductVersion updateProductVersion(long productVersionId,
122: String version, String changeLog, String downloadPageURL,
123: String directDownloadURL, boolean repoStoreArtifact,
124: long[] frameworkVersionIds) throws PortalException,
125: SystemException {
126:
127: SCProductVersion productVersion = scProductVersionLocalService
128: .getProductVersion(productVersionId);
129:
130: SCProductEntryPermission.check(getPermissionChecker(),
131: productVersion.getProductEntryId(), ActionKeys.UPDATE);
132:
133: return scProductVersionLocalService.updateProductVersion(
134: productVersionId, version, changeLog, downloadPageURL,
135: directDownloadURL, repoStoreArtifact,
136: frameworkVersionIds);
137: }
138:
139: }
|