1 28 package net.sf.jasperreports.engine.base; 29 30 import java.io.Serializable ; 31 32 import net.sf.jasperreports.engine.JRConstants; 33 import net.sf.jasperreports.engine.JRDatasetParameter; 34 import net.sf.jasperreports.engine.JRDatasetRun; 35 import net.sf.jasperreports.engine.JRExpression; 36 37 43 public class JRBaseDatasetRun implements JRDatasetRun, Serializable 44 { 45 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 46 47 protected String datasetName; 48 protected JRExpression parametersMapExpression; 49 protected JRDatasetParameter[] parameters; 50 protected JRExpression connectionExpression; 51 protected JRExpression dataSourceExpression; 52 53 54 57 protected JRBaseDatasetRun() 58 { 59 } 60 61 62 68 protected JRBaseDatasetRun(JRDatasetRun datasetRun, JRBaseObjectFactory factory) 69 { 70 factory.put(datasetRun, this); 71 72 datasetName = datasetRun.getDatasetName(); 73 parametersMapExpression = factory.getExpression(datasetRun.getParametersMapExpression()); 74 connectionExpression = factory.getExpression(datasetRun.getConnectionExpression()); 75 dataSourceExpression = factory.getExpression(datasetRun.getDataSourceExpression()); 76 77 JRDatasetParameter[] datasetParams = datasetRun.getParameters(); 78 if (datasetParams != null && datasetParams.length > 0) 79 { 80 parameters = new JRBaseDatasetParameter[datasetParams.length]; 81 for (int i = 0; i < parameters.length; i++) 82 { 83 parameters[i] = factory.getDatasetParameter(datasetParams[i]); 84 } 85 } 86 } 87 88 public String getDatasetName() 89 { 90 return datasetName; 91 } 92 93 public JRExpression getParametersMapExpression() 94 { 95 return parametersMapExpression; 96 } 97 98 public JRDatasetParameter[] getParameters() 99 { 100 return parameters; 101 } 102 103 public JRExpression getConnectionExpression() 104 { 105 return connectionExpression; 106 } 107 108 public JRExpression getDataSourceExpression() 109 { 110 return dataSourceExpression; 111 } 112 } 113 | Popular Tags |