public static List<?> getGroupList(TableComponent table, JRReport report) { List<?> groupsList = null; JRDatasetRun datasetRun = table.getDatasetRun(); if (datasetRun != null) { String dataSetName = datasetRun.getDatasetName(); JRDataset[] datasets = report.getDatasets(); if (datasets != null && dataSetName != null) { for (JRDataset ds : datasets) { JRGroup[] groups = ds.getGroups(); if (dataSetName.equals(ds.getName()) && groups != null) { groupsList = Arrays.asList(groups); break; } } } } return groupsList; }
public void verifyElementDataset(JRElementDataset dataset) { JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { IncrementTypeEnum incrementType = dataset.getIncrementTypeValue(); if (incrementType == IncrementTypeEnum.PAGE || incrementType == IncrementTypeEnum.COLUMN) { addBrokenRule("Chart datasets with dataset run cannont have Column or Page increment type.", dataset); } ResetTypeEnum resetType = dataset.getResetTypeValue(); if (resetType == ResetTypeEnum.PAGE || resetType == ResetTypeEnum.COLUMN) { addBrokenRule("Chart datasets with dataset run cannont have Column or Page reset type.", dataset); } // else if (resetType != ResetTypeEnum.REPORT) // { // //doesn't make sense, but let it go // } verifyDatasetRun(datasetRun); } }
/** * Register an element dataset with the report filler. * * <p> * Registration of element datasets is required in order for the filler * to increment the datasets when iterating through the datasource. * * @param elementDataset the dataset to register */ public void registerElementDataset(JRFillElementDataset elementDataset) { List<JRFillElementDataset> elementDatasetsList; JRDatasetRun datasetRun = elementDataset.getDatasetRun(); if (datasetRun == null) { elementDatasetsList = elementDatasets; } else { String datasetName = datasetRun.getDatasetName(); elementDatasetsList = getElementDatasetsList(datasetName); registerDatasetRun((JRFillDatasetRun) datasetRun); } elementDatasetsList.add(elementDataset); }
@Override public void collectExpressions(Component component, JRExpressionCollector collector) { ListComponent listComponent = (ListComponent) component; JRDatasetRun datasetRun = listComponent.getDatasetRun(); collector.collect(datasetRun); JRExpressionCollector datasetCollector = collector.getDatasetCollector( datasetRun.getDatasetName()); JRElement[] elements = listComponent.getContents().getElements(); if (elements != null) { for (int i = 0; i < elements.length; i++) { elements[i].collectExpressions(datasetCollector); } } }
@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { JRXmlLoader xmlLoader = getXmlLoader(); TableComponent table = getTableComponent(); JRDatasetRun datasetRun = table.getDatasetRun(); String datasetName = datasetRun == null ? null : datasetRun.getDatasetName(); if (log.isDebugEnabled()) { log.debug("Pushing report context for dataset name " + datasetName); } XmlLoaderReportContext reportContext = new XmlLoaderReportContext(datasetName); xmlLoader.pushReportContext(reportContext); }
private void fixDSParametersList() { JRDatasetParameter[] currParams = (JRDatasetParameter[]) tableViewerDatasetRunParams.getInput(); String datasetName = ""; JRDatasetRun jrDatasetRun = datasetRunInstance.getJRDatasetRun(); if(jrDatasetRun!=null) { datasetName = jrDatasetRun.getDatasetName(); List<JRParameter> parameters4Datasource = ModelUtils.getParameters4Datasource(datasetRunInstance.getEditableDataset().getJasperDesign(), datasetName); if(currParams!=null) { for(JRDatasetParameter p1 : currParams) { for(JRParameter p2 : parameters4Datasource) { if(p2.getName().equals(p1.getName())){ datasetRunInstance.addParameter((JRDatasetParameter) p1.clone()); break; } } } } tableViewerDatasetRunParams.setInput(datasetRunInstance.getJRDatasetRun().getParameters()); } else { // switching to main one tableViewerDatasetRunParams.getTable().clearAll(); } }
@Override public void collect(JRChart element) { JRDesignChart chart = (JRDesignChart)element; super.collect(element); chart.getDataset().collectExpressions(this); chart.getPlot().collectExpressions(this); JRDatasetRun datasetRun = chart.getDataset().getDatasetRun(); if (datasetRun != null && datasetRun.getDatasetName() != null) { JRExpressionCollector collector = getCollector( (JRDataset)jasperDesign.getDatasetMap().get(datasetRun.getDatasetName())); extraExpressions.addAll(collector.getExpressions()); } System.out.flush(); }
public JRBaseDatasetRun getDatasetRun(JRDatasetRun datasetRun) { JRBaseDatasetRun baseDatasetRun = null; if (datasetRun != null) { baseDatasetRun = (JRBaseDatasetRun)get(datasetRun); if (baseDatasetRun == null) { baseDatasetRun = new JRBaseDatasetRun(datasetRun, this); } } return baseDatasetRun; }
/** * Creates a copy of a dataset instantiation. * * @param datasetRun the dataset instantiation * @param factory the base object factory */ protected JRBaseDatasetRun(JRDatasetRun datasetRun, JRBaseObjectFactory factory) { factory.put(datasetRun, this); uuid = datasetRun.getUUID(); datasetName = datasetRun.getDatasetName(); parametersMapExpression = factory.getExpression(datasetRun.getParametersMapExpression()); connectionExpression = factory.getExpression(datasetRun.getConnectionExpression()); dataSourceExpression = factory.getExpression(datasetRun.getDataSourceExpression()); propertiesMap = JRPropertiesMap.getPropertiesClone(datasetRun); JRDatasetParameter[] datasetParams = datasetRun.getParameters(); if (datasetParams != null && datasetParams.length > 0) { parameters = new JRBaseDatasetParameter[datasetParams.length]; for (int i = 0; i < parameters.length; i++) { parameters[i] = factory.getDatasetParameter(datasetParams[i]); } } List<ReturnValue> datesetReturnValues = datasetRun.getReturnValues(); if (datesetReturnValues != null && !datesetReturnValues.isEmpty()) { this.returnValues = new ArrayList<ReturnValue>(datesetReturnValues.size()); for (ReturnValue datasetReturnValue : datesetReturnValues) { BaseReturnValue returnValue = factory.getReturnValue(datasetReturnValue); this.returnValues.add(returnValue); } } }
private static void addDatasetRules(Digester digester) { String subDatasetPattern = "jasperReport/" + JRXmlConstants.ELEMENT_subDataset; digester.addFactoryCreate(subDatasetPattern, JRDatasetFactory.class.getName()); digester.addSetNext(subDatasetPattern, "addDataset", JRDesignDataset.class.getName()); String datasetRunPattern = "*/" + JRXmlConstants.ELEMENT_datasetRun; digester.addFactoryCreate(datasetRunPattern, JRDatasetRunFactory.class.getName()); digester.addSetNext(datasetRunPattern, "setDatasetRun", JRDatasetRun.class.getName()); String datasetParamPattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_datasetParameter; digester.addFactoryCreate(datasetParamPattern, JRDatasetRunParameterFactory.class.getName()); digester.addSetNext(datasetParamPattern, "addParameter", JRDatasetParameter.class.getName()); String datasetParamExprPattern = datasetParamPattern + "/" + JRXmlConstants.ELEMENT_datasetParameterExpression; digester.addFactoryCreate(datasetParamExprPattern, JRExpressionFactory.class.getName()); digester.addSetNext(datasetParamExprPattern, "setExpression", JRExpression.class.getName()); digester.addCallMethod(datasetParamExprPattern, "setText", 0); String returnValuePattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_returnValue; digester.addObjectCreate(returnValuePattern, DesignReturnValue.class.getName()); digester.addSetProperties(returnValuePattern, new String[]{JRXmlConstants.ATTRIBUTE_incrementerFactoryClass, JRXmlConstants.ATTRIBUTE_calculation}, new String[]{"incrementerFactoryClassName"}); digester.addRule(returnValuePattern, new XmlConstantPropertyRule( JRXmlConstants.ATTRIBUTE_calculation, CalculationEnum.values())); digester.addSetNext(returnValuePattern, "addReturnValue"); }
/** * Writes the JRXML representation of an {@link JRElementDataset element dataset}. * * <p> * The method produces a <code><dataset></code> XML element. * * @param dataset the element dataset * @param defaultResetType the default dataset reset type * @param skipIfEmpty if set, no output will be produced if the element dataset * only has default attribute values * @throws IOException any I/O exception that occurred while writing the * XML output */ public void writeElementDataset(JRElementDataset dataset, ResetTypeEnum defaultResetType, boolean skipIfEmpty) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_dataset, getNamespace()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_resetType, dataset.getResetTypeValue(), defaultResetType); if (dataset.getResetTypeValue() == ResetTypeEnum.GROUP) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_resetGroup, dataset.getResetGroup().getName()); } writer.addAttribute(JRXmlConstants.ATTRIBUTE_incrementType, dataset.getIncrementTypeValue(), IncrementTypeEnum.NONE); if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_incrementGroup, dataset.getIncrementGroup().getName()); } writeExpression(JRXmlConstants.ELEMENT_incrementWhenExpression, dataset.getIncrementWhenExpression(), false); JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { writeDatasetRun(datasetRun); } writer.closeElement(skipIfEmpty); }
public static JRDataset findSubdataset(JRDatasetRun datasetRun, JasperReport report) { JRDataset[] datasets = report.getDatasets(); JRDataset reportDataset = null; if (datasets != null) { for (int i = 0; i < datasets.length; i++) { if (datasetRun.getDatasetName().equals( datasets[i].getName())) { reportDataset = datasets[i]; break; } } } if (reportDataset == null) { throw new JRRuntimeException( EXCEPTION_MESSAGE_KEY_REPORT_SUBDATASET_NOT_FOUND, new Object[]{datasetRun.getDatasetName(), report.getName()}); } return reportDataset; }
/** * Writes the JRXML representation of an {@link JRElementDataset element dataset}. * * <p> * The method produces a <code><dataset></code> XML element. * * @param dataset the element dataset * @param skipIfEmpty if set, no output will be produced if the element dataset * only has default attribute values */ public void writeElementDataset( JRElementDataset dataset, boolean skipIfEmpty, String datasetName) { if(dataset != null) { write( datasetName + ".setResetType({0});\n", dataset.getResetTypeValue(), ResetTypeEnum.REPORT); if (dataset.getResetTypeValue() == ResetTypeEnum.GROUP) { String resetGroupName = getGroupName( dataset.getResetGroup()); write( datasetName + ".setResetGroup(" + resetGroupName + ");\n"); } write( datasetName + ".setIncrementType({0});\n", dataset.getIncrementTypeValue(), IncrementTypeEnum.NONE); if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP) { String incrementGroupName = getGroupName( dataset.getIncrementGroup()); write( datasetName + ".setIncrementGroup(" + incrementGroupName + ");\n"); } writeExpression( dataset.getIncrementWhenExpression(), datasetName, "IncrementWhenExpression"); JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { writeDatasetRun( datasetRun, datasetName); } flush(); } }
/** * Outputs the XML representation of a subdataset run object. * * @param datasetRun the subdataset run */ public void writeDatasetRun( JRDatasetRun datasetRun, String parentName) { if(datasetRun != null) { String runName = parentName + "Run"; write( "JRDesignDatasetRun " + runName + " = new JRDesignDatasetRun();\n"); write( runName + ".setDatasetName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(datasetRun.getDatasetName())); writeExpression( datasetRun.getParametersMapExpression(), runName, "ParametersMapExpression"); JRDatasetParameter[] parameters = datasetRun.getParameters(); if (parameters != null && parameters.length > 0) { for(int i = 0; i < parameters.length; i++) { writeDatasetParameter( parameters[i], runName, runName + "Parameter" + i); } } writeExpression( datasetRun.getConnectionExpression(), runName, "ConnectionExpression"); writeExpression( datasetRun.getDataSourceExpression(), runName, "DataSourceExpression"); List<ReturnValue> returnValues = datasetRun.getReturnValues(); if (returnValues != null && !returnValues.isEmpty()) { for (ListIterator<ReturnValue> it = returnValues.listIterator(); it.hasNext();) { ReturnValue returnValue = it.next(); String returnValueVarName = runName + "ReturnValue" + it.previousIndex(); writeReturnValue(returnValue, returnValueVarName); write(runName + ".addReturnValue(" + returnValueVarName + ");\n"); } } write( parentName + ".setDatasetRun(" + runName + ");\n"); flush(); } }
/** * Sets the sub dataset run for this dataset. * * @param datasetRun the dataset run * @see JRElementDataset#getDatasetRun() */ public void setDatasetRun(JRDatasetRun datasetRun) { Object old = this.datasetRun; this.datasetRun = datasetRun; getEventSupport().firePropertyChange(PROPERTY_DATASET_RUN, old, this.datasetRun); }
public JRFillDatasetRun getDatasetRun(JRDatasetRun datasetRun) { JRFillDatasetRun fillDatasetRun = null; if (datasetRun != null) { fillDatasetRun = (JRFillDatasetRun) get(datasetRun); if (fillDatasetRun == null) { fillDatasetRun = new JRFillDatasetRun(datasetRun, this); } } return fillDatasetRun; }
protected JRFillDatasetRun(JRBaseFiller filler, JRFillExpressionEvaluator expressionEvaluator, JRDatasetRun datasetRun, JRFillObjectFactory factory) { this(filler, expressionEvaluator, datasetRun, filler.datasetMap.get(datasetRun.getDatasetName())); factory.put(datasetRun, this); initReturnValues(factory); }
protected JRFillDatasetRun(BaseReportFiller filler, JRFillExpressionEvaluator expressionEvaluator, JRDatasetRun datasetRun, JRFillDataset dataset) { this.filler = filler; this.expressionEvaluator = expressionEvaluator; this.dataset = dataset; this.parentDatasetRun = datasetRun; parametersMapExpression = datasetRun.getParametersMapExpression(); parameters = datasetRun.getParameters(); connectionExpression = datasetRun.getConnectionExpression(); dataSourceExpression = datasetRun.getDataSourceExpression(); }
/** * @deprecated To be removed. */ private void writeMarkerDataset(net.sf.jasperreports.components.map.MarkerDataset dataset, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException { if (dataset != null) { writer.startElement(MapXmlFactory.ELEMENT_markerDataset, namespace); JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { reportWriter.writeDatasetRun(datasetRun); } /* */ List<net.sf.jasperreports.components.map.Marker> markerList = dataset.getMarkers(); if (markerList != null && !markerList.isEmpty()) { for(net.sf.jasperreports.components.map.Marker marker : markerList) { if(marker.getProperties() != null && !marker.getProperties().isEmpty()) { writeMarker(marker, writer, reportWriter, namespace, componentElement); } } } writer.closeElement(); } }
/** * Sets the subdataset run information that will be used to create the marker list. * * @param datasetRun the subdataset run information * @see #getDatasetRun() */ public void setDatasetRun(JRDatasetRun datasetRun) { Object old = this.datasetRun; this.datasetRun = datasetRun; getEventSupport().firePropertyChange(PROPERTY_DATASET_RUN, old, this.datasetRun); }
/** * @deprecated Replaced by {@link ItemCompiler#collectExpressions(ItemData, JRExpressionCollector)}. */ public static void collectExpressions(MarkerDataset dataset, JRExpressionCollector collector) { if(dataset != null) { JRExpressionCollector datasetCollector = collector; JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { collector.collect(datasetRun); datasetCollector = collector.getDatasetCollector(datasetRun.getDatasetName()); } List<Marker> markers = dataset.getMarkers(); if (markers != null && !markers.isEmpty()) { for(Marker marker : markers) { List<MarkerProperty> markerProperties = marker.getProperties(); if(markerProperties != null) { for(MarkerProperty property : markerProperties) { datasetCollector.addExpression(property.getValueExpression()); } } } } } }
/** * Sets the subdataset run information that will be used by this list. * * @param datasetRun the subdataset run information * @see #getDatasetRun() */ public void setDatasetRun(JRDatasetRun datasetRun) { Object old = this.datasetRun; this.datasetRun = datasetRun; getEventSupport().firePropertyChange(PROPERTY_DATASET_RUN, old, this.datasetRun); }
public FillDatasetRun(JRDatasetRun datasetRun, JRFillObjectFactory factory) throws JRException { super(factory.getReportFiller(), factory.getExpressionEvaluator(), datasetRun, createFillDataset(datasetRun, factory)); initReturnValues(factory); factory.registerDatasetRun(this); }
private static JRFillDataset createFillDataset(JRDatasetRun datasetRun, JRFillObjectFactory factory) throws JRException { JasperReport jasperReport = factory.getReportFiller().getJasperReport(); JRDataset reportDataset = JRReportUtils.findSubdataset(datasetRun, jasperReport); FillListDatasetFactory datasetFactory = new FillListDatasetFactory(factory); JRFillDataset fillDataset = datasetFactory.getDataset(reportDataset); fillDataset.createCalculator(jasperReport); fillDataset.inheritFromMain(); return fillDataset; }
public void setDatasetRun(JRDatasetRun datasetRun) { Object old = this.datasetRun; this.datasetRun = datasetRun; getEventSupport().firePropertyChange(PROPERTY_DATASET_RUN, old, this.datasetRun); }
@Override public void collectExpressions(Component component, JRExpressionCollector collector) { TableComponent table = (TableComponent) component; JRDatasetRun datasetRun = table.getDatasetRun(); collector.collect(datasetRun); JRExpressionCollector datasetCollector = collector.getDatasetCollector( datasetRun.getDatasetName()); ColumnExpressionCollector columnCollector = new ColumnExpressionCollector( collector, datasetCollector); columnCollector.collectColumns(table.getColumns()); }
@Override public void verify(Component component, JRVerifier verifier) { TableComponent table = (TableComponent) component; JRDatasetRun datasetRun = table.getDatasetRun(); if (datasetRun == null) { verifier.addBrokenRule("No list subdataset run set", table); } else { verifier.verifyDatasetRun(datasetRun); } List<BaseColumn> columns = table.getColumns(); if (columns == null || columns.isEmpty()) { verifier.addBrokenRule("No columns defined in the table", table); } else { if (!detectLoops(verifier, columns)) { verifyColumns(table, verifier); verifyColumnHeights(table, verifier); } } }
protected void verifyGroupCells(TableComponent table, List<GroupCell> cells, int width, String cellName, JRVerifier verifier) { if (cells != null) { Set<String> groupNames = new HashSet<String>(); for (GroupCell groupCell : cells) { String groupName = groupCell.getGroupName(); if (groupName == null) { verifier.addBrokenRule("No group name set for table column group cell", groupCell); } else { if (!groupNames.add(groupName)) { verifier.addBrokenRule("Duplicate " + cellName + " for group \"" + groupName + "\"", groupCell); } JRDatasetRun datasetRun = table.getDatasetRun(); if (datasetRun != null) { JRDesignDataset dataset = (JRDesignDataset) verifier.getReportDesign().getDatasetMap().get( datasetRun.getDatasetName()); if (dataset != null && dataset.getGroupsMap().get(groupName) == null) { verifier.addBrokenRule("No group named \"" + groupName + "\" found in subdataset " + datasetRun.getDatasetName(), groupCell); } } } verifyCell(groupCell.getCell(), width, cellName, verifier); } } }
public TableSubreport(JRDatasetRun datasetRun, JRComponentElement componentElement) { super(componentElement); this.datasetRun = datasetRun; JRDatasetParameter[] datasetParameters = datasetRun.getParameters(); if (datasetParameters == null) { this.parameters = null; } else { this.parameters = new JRSubreportParameter[datasetParameters.length]; for (int i = 0; i < datasetParameters.length; i++) { JRDatasetParameter datasetParameter = datasetParameters[i]; TableSubreportParameter subreportParameter = new TableSubreportParameter(datasetParameter); this.parameters[i] = subreportParameter; } } List<ReturnValue> datasetReturnValues = datasetRun.getReturnValues(); if (datasetReturnValues == null || datasetReturnValues.isEmpty()) { returnValues = null; } else { returnValues = new JRSubreportReturnValue[datasetReturnValues.size()]; for (ListIterator<ReturnValue> it = datasetReturnValues.listIterator(); it.hasNext();) { ReturnValue returnValue = it.next(); returnValues[it.previousIndex()] = new SubreportReturnValueAdapter(returnValue); } } }
public static void collectExpressions(ItemData data, JRExpressionCollector collector) { if (data != null) { JRExpressionCollector datasetCollector = collector; JRElementDataset dataset = data.getDataset(); JRDatasetRun datasetRun = dataset == null ? null : dataset.getDatasetRun(); if (datasetRun != null) { collector.collect(datasetRun); datasetCollector = collector.getDatasetCollector(datasetRun.getDatasetName()); } List<Item> items = data.getItems(); if (items != null && !items.isEmpty()) { for(Item item : items) { List<ItemProperty> itemProperties = item.getProperties(); if(itemProperties != null) { for(ItemProperty property : itemProperties) { datasetCollector.addExpression(property.getValueExpression()); } } } } } }
public Map<String,String> getElementDatasetsMap() { Map<String,String> map = new HashMap<String, String>(); for(MapDataDatasetDTO d : datasets) { JRDatasetRun dsRun = d.getDataset().getDatasetRun(); String designDSname = ""; //$NON-NLS-1$ if(dsRun!=null){ designDSname = dsRun.getDatasetName(); } map.put(d.getName(), designDSname); } return map; }
public CreateListElement4ObjectCommand(ANode child, MList parent, Rectangle location, int index) { super(parent, null, location, index); JasperDesign jd = parent.getJasperDesign(); JRDatasetRun dr = parent.getList().getDatasetRun(); if (dr != null) { String dbname = dr.getDatasetName(); if (dbname != null) jDataset = (JRDesignDataset) jd.getDatasetMap().get(dbname); } this.child = child; this.parent = parent; }
/** * Add the dataset group listener to the current table dataset, but before remove * the old one if present */ private void addDatasetGroupListener(){ if (datasetWithListener != null){ datasetWithListener.getEventSupport().removePropertyChangeListener(datasetGroupListener); } JRDatasetRun datasetRun = getStandardTable().getDatasetRun(); JasperDesign design = getJasperDesign(); if (design != null){ JRDesignDataset dataset = (JRDesignDataset)design.getDatasetMap().get(datasetRun.getDatasetName()); datasetWithListener = dataset; if (dataset != null){ dataset.getEventSupport().addPropertyChangeListener(datasetGroupListener); } } }
@Override public JRDatasetRun getDatasetRun() { return datasetRun; }
/** * Outputs the XML representation of a subdataset run object. * * @param datasetRun the subdataset run * @throws IOException */ public void writeDatasetRun(JRDatasetRun datasetRun) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_datasetRun, getNamespace()); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_subDataset, datasetRun.getDatasetName()); if (isNewerVersionOrEqual(JRConstants.VERSION_4_6_0)) { if (!isExcludeUuids()) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_uuid, datasetRun.getUUID().toString()); } writeProperties(datasetRun); } writeExpression(JRXmlConstants.ELEMENT_parametersMapExpression, datasetRun.getParametersMapExpression(), false); /* */ JRDatasetParameter[] parameters = datasetRun.getParameters(); if (parameters != null && parameters.length > 0) { for(int i = 0; i < parameters.length; i++) { writeDatasetParameter(parameters[i]); } } writeExpression(JRXmlConstants.ELEMENT_connectionExpression, datasetRun.getConnectionExpression(), false); writeExpression(JRXmlConstants.ELEMENT_dataSourceExpression, datasetRun.getDataSourceExpression(), false); List<ReturnValue> returnValues = datasetRun.getReturnValues(); if (returnValues != null && !returnValues.isEmpty()) { for (ReturnValue returnValue : returnValues) { writeReturnValue(returnValue); } } writer.closeElement(); }
/** * Verifies a subdataset run object. * * @param datasetRun the subdataset run */ public void verifyDatasetRun(JRDatasetRun datasetRun) { JRDesignDataset dataset = null; String datasetName = datasetRun.getDatasetName(); if (datasetName == null || datasetName.length() == 0) { addBrokenRule("Dataset name is missing for dataset run.", datasetRun); } else { dataset = (JRDesignDataset) jasperDesign.getDatasetMap().get(datasetName); if (dataset == null) { addBrokenRule("Unknown dataset name " + datasetName + ".", datasetRun); } } JRDatasetParameter[] parameters = datasetRun.getParameters(); if (parameters != null && parameters.length > 0) { for(int index = 0; index < parameters.length; index++) { JRDatasetParameter parameter = parameters[index]; String paramName = parameter.getName(); if (paramName == null || paramName.trim().length() == 0) { addBrokenRule("Dataset " + datasetName + " parameter name missing.", parameter); } JRParameter datasetParam = null; if (dataset != null) { datasetParam = dataset.getParametersMap().get(paramName); if (datasetParam == null) { addBrokenRule("Unknown parameter " + paramName + " in dataset " + datasetName + ".", parameter); } } } } JRExpression connectionExpression = datasetRun.getConnectionExpression(); JRExpression dataSourceExpression = datasetRun.getDataSourceExpression(); if (connectionExpression != null && dataSourceExpression != null) { addBrokenRule("Dataset " + datasetName + " cannot have both connection expresion and data source expression.", datasetRun); } List<ReturnValue> returnValues = datasetRun.getReturnValues(); if (returnValues != null && !returnValues.isEmpty()) { for (ReturnValue returnValue : returnValues) { verifyReturnValue(returnValue); } } }
protected JRFillDatasetRun(JRDatasetRun datasetRun, JRFillObjectFactory factory) { this(factory.getFiller(), factory.getExpressionEvaluator(), datasetRun, factory); }
protected JRFillDatasetRun(BaseReportFiller filler, JRDatasetRun datasetRun, JRFillDataset dataset) { this(filler, filler.getExpressionEvaluator(), datasetRun, dataset); }