001    /**
002     * Copyright (c) 2000-2011 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.dynamicdatalists.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.dynamicdatalists.model.DDLRecordSet;
022    import com.liferay.portlet.dynamicdatalists.service.base.DDLRecordSetServiceBaseImpl;
023    import com.liferay.portlet.dynamicdatalists.service.permission.DDLPermission;
024    import com.liferay.portlet.dynamicdatalists.service.permission.DDLRecordSetPermission;
025    
026    import java.util.Locale;
027    import java.util.Map;
028    
029    /**
030     * @author Brian Wing Shun Chan
031     * @author Marcellus Tavares
032     */
033    public class DDLRecordSetServiceImpl extends DDLRecordSetServiceBaseImpl {
034    
035            public DDLRecordSet addRecordSet(
036                            long groupId, long ddmStructureId, String recordSetKey,
037                            Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
038                            int minDisplayRows, int scope, ServiceContext serviceContext)
039                    throws PortalException, SystemException {
040    
041                    DDLPermission.check(
042                            getPermissionChecker(), groupId, ActionKeys.ADD_RECORD_SET);
043    
044                    return ddlRecordSetLocalService.addRecordSet(
045                            getUserId(), groupId, ddmStructureId, recordSetKey, nameMap,
046                            descriptionMap, minDisplayRows, scope, serviceContext);
047            }
048    
049            public void deleteRecordSet(long recordSetId)
050                    throws PortalException, SystemException {
051    
052                    DDLRecordSetPermission.check(
053                            getPermissionChecker(), recordSetId, ActionKeys.DELETE);
054    
055                    ddlRecordSetLocalService.deleteRecordSet(recordSetId);
056            }
057    
058            public DDLRecordSet getRecordSet(long recordSetId)
059                    throws PortalException, SystemException {
060    
061                    DDLRecordSetPermission.check(
062                            getPermissionChecker(), recordSetId, ActionKeys.VIEW);
063    
064                    return ddlRecordSetLocalService.getRecordSet(recordSetId);
065            }
066    
067            public DDLRecordSet updateMinDisplayRows(
068                            long recordSetId, int minDisplayRows,
069                            ServiceContext serviceContext)
070                    throws PortalException, SystemException {
071    
072                    DDLRecordSetPermission.check(
073                            getPermissionChecker(), recordSetId, ActionKeys.UPDATE);
074    
075                    return ddlRecordSetLocalService.updateMinDisplayRows(
076                            recordSetId, minDisplayRows, serviceContext);
077            }
078    
079            public DDLRecordSet updateRecordSet(
080                            long recordSetId, long ddmStructureId, Map<Locale, String> nameMap,
081                            Map<Locale, String> descriptionMap, int minDisplayRows,
082                            ServiceContext serviceContext)
083                    throws PortalException, SystemException {
084    
085                    DDLRecordSetPermission.check(
086                            getPermissionChecker(), recordSetId, ActionKeys.UPDATE);
087    
088                    return ddlRecordSetLocalService.updateRecordSet(
089                            recordSetId, ddmStructureId, nameMap, descriptionMap,
090                            minDisplayRows, serviceContext);
091            }
092    
093            public DDLRecordSet updateRecordSet(
094                            long groupId, long ddmStructureId, String recordSetKey,
095                            Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
096                            int minDisplayRows, ServiceContext serviceContext)
097                    throws PortalException, SystemException {
098    
099                    DDLRecordSetPermission.check(
100                            getPermissionChecker(), groupId, recordSetKey, ActionKeys.UPDATE);
101    
102                    return ddlRecordSetLocalService.updateRecordSet(
103                            groupId, ddmStructureId, recordSetKey, nameMap, descriptionMap,
104                            minDisplayRows, serviceContext);
105            }
106    
107    }