com.bemis.portal.report.service.impl.ReportRequestServiceImpl.java Source code

Java tutorial

Introduction

Here is the source code for com.bemis.portal.report.service.impl.ReportRequestServiceImpl.java

Source

/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.bemis.portal.report.service.impl;

import aQute.bnd.annotation.ProviderType;

import com.bemis.portal.report.definition.ReportParameter;
import com.bemis.portal.report.model.ReportRequest;
import com.bemis.portal.report.service.base.ReportRequestServiceBaseImpl;
import com.bemis.portal.report.service.permission.ReportRequestEntryPermissionCheckerUtil;
import com.bemis.portal.report.service.permission.ReportRequestPermissionCheckerUtil;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.security.permission.ActionKeys;
import com.liferay.portal.kernel.service.ServiceContext;

import java.io.Serializable;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author Michael C. Han
 * @see ReportRequestServiceBaseImpl
 * @see com.bemis.portal.report.service.ReportRequestServiceUtil
 */
@ProviderType
public class ReportRequestServiceImpl extends ReportRequestServiceBaseImpl {

    @Override
    public ReportRequest addReportRequest(long reportDefinitionId, String reportFormat, Set<String> reportFields,
            Set<String> sortFields, Map<ReportParameter, Serializable> reportParameters,
            ServiceContext serviceContext) throws PortalException {

        ReportRequestPermissionCheckerUtil.check(getPermissionChecker(), serviceContext.getScopeGroupId(),
                ActionKeys.ADD_ENTRY);

        return reportRequestLocalService.addReportRequest(reportDefinitionId, reportFormat, reportFields,
                sortFields, reportParameters, serviceContext);
    }

    @Override
    public ReportRequest deleteReportRequest(long reportRequestId) throws PortalException {

        ReportRequest reportRequest = reportRequestLocalService.getReportRequest(reportRequestId);

        ReportRequestEntryPermissionCheckerUtil.checkBaseModel(getPermissionChecker(), reportRequest.getGroupId(),
                reportRequestId, ActionKeys.DELETE);

        return reportRequestLocalService.deleteReportRequest(reportRequest);
    }

    @Override
    public ReportRequest deleteReportRequest(ReportRequest reportRequest) throws PortalException {

        ReportRequestEntryPermissionCheckerUtil.checkBaseModel(getPermissionChecker(), reportRequest.getGroupId(),
                reportRequest.getReportRequestId(), ActionKeys.DELETE);

        return reportRequestLocalService.deleteReportRequest(reportRequest);
    }

    @Override
    public List<ReportRequest> getReportRequestsByC_G(long companyId, long groupId) {

        return reportRequestPersistence.filterFindByC_G(companyId, groupId);
    }

}