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.schedulable;
017
018import java.util.HashMap;
019import java.util.Map;
020
021import org.quartz.JobDataMap;
022
023import org.ametys.core.schedule.Schedulable;
024import org.ametys.plugins.core.schedule.Scheduler;
025import org.ametys.plugins.odfpilotage.report.PilotageReport;
026import org.ametys.plugins.odfpilotage.report.PilotageReport.PilotageReportTarget;
027
028/**
029 * {@link Schedulable} for pilotage report by program.
030 */
031public class ProgramReportSchedulable extends AbstractReportSchedulable
032{
033    /** The key for the program */
034    public static final String JOBDATAMAP_PROGRAM_KEY = "program";
035    
036    @Override
037    protected PilotageReportTarget getTarget()
038    {
039        return PilotageReportTarget.PROGRAM;
040    }
041
042    @Override
043    protected Map<String, String> getReportParameters(JobDataMap jobDataMap)
044    {
045        Map<String, String> reportParameters = new HashMap<>();
046        reportParameters.put(PilotageReport.PARAMETER_PROGRAM, jobDataMap.getString(Scheduler.PARAM_VALUES_PREFIX + JOBDATAMAP_PROGRAM_KEY));
047        return reportParameters;
048    }
049}