1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 package com.sun.star.report.util; 24 25 import com.sun.star.report.DataSourceFactory; 26 import com.sun.star.report.InputRepository; 27 import com.sun.star.report.JobDefinitionException; 28 import com.sun.star.report.JobProperties; 29 import com.sun.star.report.OutputRepository; 30 import com.sun.star.report.ParameterMap; 31 import com.sun.star.report.ReportEngineMetaData; 32 import com.sun.star.report.ReportEngineParameterNames; 33 import com.sun.star.report.ReportJobDefinition; 34 35 public class DefaultReportJobDefinition implements ReportJobDefinition 36 { 37 38 public static final String OUTPUT_TYPE = "output-type"; 39 private final DefaultParameterMap parameters; 40 private final DefaultJobProperties properties; 41 DefaultReportJobDefinition(final ReportEngineMetaData metaData)42 public DefaultReportJobDefinition(final ReportEngineMetaData metaData) 43 { 44 this.parameters = new DefaultParameterMap(); 45 this.properties = new DefaultJobProperties(metaData); 46 } 47 setDataSourceFactory(final DataSourceFactory dataSourceFactory)48 public void setDataSourceFactory(final DataSourceFactory dataSourceFactory) 49 throws JobDefinitionException 50 { 51 this.properties.setProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, dataSourceFactory); 52 } 53 getDataSourceFactory()54 public DataSourceFactory getDataSourceFactory() 55 { 56 return (DataSourceFactory) this.properties.getProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY); 57 } 58 getInputRepository()59 public InputRepository getInputRepository() 60 { 61 return (InputRepository) this.properties.getProperty(ReportEngineParameterNames.INPUT_REPOSITORY); 62 } 63 setInputRepository(final InputRepository inputRepository)64 public void setInputRepository(final InputRepository inputRepository) 65 throws JobDefinitionException 66 { 67 this.properties.setProperty(ReportEngineParameterNames.INPUT_REPOSITORY, inputRepository); 68 } 69 getOutputRepository()70 public OutputRepository getOutputRepository() 71 { 72 return (OutputRepository) this.properties.getProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY); 73 } 74 setOutputRepository(final OutputRepository outputRepository)75 public void setOutputRepository(final OutputRepository outputRepository) 76 throws JobDefinitionException 77 { 78 this.properties.setProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY, outputRepository); 79 } 80 81 /** 82 * The parameters of the root report definition. The parameters for the subreports are 83 * defined using mappings, it would not make sense to define them here. 84 * 85 * @return a map container for query parameters. 86 */ getQueryParameters()87 public ParameterMap getQueryParameters() 88 { 89 return parameters; 90 } 91 setReportDefinitionName(final String reportDefinitionName)92 public void setReportDefinitionName(final String reportDefinitionName) 93 throws JobDefinitionException 94 { 95 this.properties.setProperty(ReportEngineParameterNames.INPUT_NAME, reportDefinitionName); 96 } 97 98 /** 99 * The name under which we can load the report definition. 100 * 101 * @return the report definition's name. 102 */ getReportDefinitionName()103 public String getReportDefinitionName() 104 { 105 return (String) this.properties.getProperty(ReportEngineParameterNames.INPUT_NAME); 106 } 107 getProcessingParameters()108 public JobProperties getProcessingParameters() 109 { 110 return properties; 111 } 112 } 113