001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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.permission.PortalPermissionUtil;
021    import com.liferay.portlet.softwarecatalog.model.SCLicense;
022    import com.liferay.portlet.softwarecatalog.service.base.SCLicenseServiceBaseImpl;
023    import com.liferay.portlet.softwarecatalog.service.permission.SCLicensePermission;
024    
025    /**
026     * @author Jorge Ferrer
027     * @author Brian Wing Shun Chan
028     */
029    public class SCLicenseServiceImpl extends SCLicenseServiceBaseImpl {
030    
031            public SCLicense addLicense(
032                            String name, String url, boolean openSource, boolean active,
033                            boolean recommended)
034                    throws PortalException, SystemException {
035    
036                    PortalPermissionUtil.check(
037                            getPermissionChecker(), ActionKeys.ADD_LICENSE);
038    
039                    return scLicenseLocalService.addLicense(
040                            name, url, openSource, active, recommended);
041            }
042    
043            public void deleteLicense(long licenseId)
044                    throws PortalException, SystemException {
045    
046                    SCLicensePermission.check(
047                            getPermissionChecker(), licenseId, ActionKeys.DELETE);
048    
049                    scLicenseLocalService.deleteLicense(licenseId);
050            }
051    
052            public SCLicense getLicense(long licenseId)
053                    throws PortalException, SystemException {
054    
055                    return scLicenseLocalService.getLicense(licenseId);
056            }
057    
058            public SCLicense updateLicense(
059                            long licenseId, String name, String url, boolean openSource,
060                            boolean active, boolean recommended)
061                    throws PortalException, SystemException {
062    
063                    SCLicensePermission.check(
064                            getPermissionChecker(), licenseId, ActionKeys.UPDATE);
065    
066                    return scLicenseLocalService.updateLicense(
067                            licenseId, name, url, openSource, active, recommended);
068            }
069    
070    }