001/*
002 *  Copyright 2018 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.odfpilotage.report;
017
018import java.util.Map;
019
020import org.ametys.core.user.UserIdentity;
021import org.ametys.plugins.odfpilotage.schedulable.AbstractReportSchedulable;
022import org.ametys.runtime.i18n.I18nizableText;
023
024/**
025 * Interface for pilotage reports.
026 */
027public interface PilotageReport
028{
029    /** The key for the output format */
030    public static final String PARAMETER_OUTPUT_FORMAT = "outputFormat";
031    /** The key for the program */
032    public static final String PARAMETER_PROGRAM = "program";
033    /** The key for the orgunit */
034    public static final String PARAMETER_ORGUNIT = "orgunit";
035    /** The key for the catalog */
036    public static final String PARAMETER_CATALOG = "catalog";
037    /** The key for the lang */
038    public static final String PARAMETER_LANG = "lang";
039
040    /** The XLS output format */
041    public static final String OUTPUT_FORMAT_XLS = "xls";
042    /** The DOC output format */
043    public static final String OUTPUT_FORMAT_DOC = "doc";
044    /** The CSV output format */
045    public static final String OUTPUT_FORMAT_CSV = "csv";
046    
047    /**
048     * The pilotage report target.
049     */
050    public enum PilotageReportTarget
051    {
052        /** To execute a report on a program */
053        PROGRAM,
054        /** To execute a report on an orgunit */
055        ORGUNIT;
056    }
057
058    /**
059     * Retrieves the id of the report.
060     * @return the id.
061     */
062    public String getId();
063    
064    /**
065     * Retrieves the label of the report.
066     * @return the label.
067     */
068    public I18nizableText getLabel();
069    
070    /**
071     * Check if the report supports the given schedulable. 
072     * @param schedulable The schedulable to check
073     * @return <code>true</code> if the schedulable is supported, <code>false</code> otherwise
074     */
075    public boolean supports(AbstractReportSchedulable schedulable);
076    
077    /**
078     * Launch a report on the given target with the given parameters.
079     * @param target The target of the report
080     * @param reportParameters The report parameters
081     * @param user The current user
082     */
083    public void launch(PilotageReportTarget target, Map<String, String> reportParameters, UserIdentity user);
084}