001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.SCFrameworkVersion;
022    import com.liferay.portlet.softwarecatalog.service.base.SCFrameworkVersionServiceBaseImpl;
023    import com.liferay.portlet.softwarecatalog.service.permission.SCFrameworkVersionPermission;
024    import com.liferay.portlet.softwarecatalog.service.permission.SCPermission;
025    
026    import java.util.List;
027    
028    /**
029     * @author Jorge Ferrer
030     * @author Brian Wing Shun Chan
031     */
032    public class SCFrameworkVersionServiceImpl
033            extends SCFrameworkVersionServiceBaseImpl {
034    
035            public SCFrameworkVersion addFrameworkVersion(
036                            String name, String url, boolean active, int priority,
037                            ServiceContext serviceContext)
038                    throws PortalException, SystemException {
039    
040                    SCPermission.check(
041                            getPermissionChecker(), serviceContext.getScopeGroupId(),
042                            ActionKeys.ADD_FRAMEWORK_VERSION);
043    
044                    return scFrameworkVersionLocalService.addFrameworkVersion(
045                            getUserId(), name, url, active, priority, serviceContext);
046            }
047    
048            public void deleteFrameworkVersion(long frameworkVersionId)
049                    throws PortalException, SystemException {
050    
051                    SCFrameworkVersionPermission.check(
052                            getPermissionChecker(), frameworkVersionId, ActionKeys.DELETE);
053    
054                    scFrameworkVersionLocalService.deleteFrameworkVersion(
055                            frameworkVersionId);
056            }
057    
058            public SCFrameworkVersion getFrameworkVersion(long frameworkVersionId)
059                    throws PortalException, SystemException {
060    
061                    return scFrameworkVersionLocalService.getFrameworkVersion(
062                            frameworkVersionId);
063            }
064    
065            public List<SCFrameworkVersion> getFrameworkVersions(
066                            long groupId, boolean active)
067                    throws SystemException {
068    
069                    return scFrameworkVersionLocalService.getFrameworkVersions(
070                            groupId, active);
071            }
072    
073            public List<SCFrameworkVersion> getFrameworkVersions(
074                            long groupId, boolean active, int start, int end)
075                    throws SystemException {
076    
077                    return scFrameworkVersionLocalService.getFrameworkVersions(
078                            groupId, active, start, end);
079            }
080    
081            public SCFrameworkVersion updateFrameworkVersion(
082                            long frameworkVersionId, String name, String url, boolean active,
083                            int priority)
084                    throws PortalException, SystemException {
085    
086                    SCFrameworkVersionPermission.check(
087                            getPermissionChecker(), frameworkVersionId, ActionKeys.UPDATE);
088    
089                    return scFrameworkVersionLocalService.updateFrameworkVersion(
090                            frameworkVersionId, name, url, active, priority);
091            }
092    
093    }