*/
private void assignGroupsToDatasets() throws JRException
{
for(Iterator it = groupBoundDatasets.iterator(); it.hasNext();)
{
JRDesignElementDataset dataset = (JRDesignElementDataset) it.next();
JRDatasetRun datasetRun = dataset.getDatasetRun();
Map groupsMap;
if (datasetRun == null)
{
groupsMap = jasperDesign.getGroupsMap();
}
else
{
Map datasetMap = jasperDesign.getDatasetMap();
String datasetName = datasetRun.getDatasetName();
JRDesignDataset subDataset = (JRDesignDataset) datasetMap.get(datasetName);
if (subDataset == null)
{
throw new JRException("Unknown sub dataset '" + datasetName + "' for chart dataset.");
}
groupsMap = subDataset.getGroupsMap();
}
if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP)
{
String groupName = null;
JRGroup group = dataset.getIncrementGroup();
if (group != null)
{
groupName = group.getName();
group = (JRGroup)groupsMap.get(group.getName());
}
if (!ignoreConsistencyProblems && group == null)
{
throw new JRValidationException("Unknown increment group '" + groupName + "' for chart dataset.", dataset);
}
dataset.setIncrementGroup(group);
}
else
{
dataset.setIncrementGroup(null);
}
if (dataset.getResetTypeValue() == ResetTypeEnum.GROUP)
{
String groupName = null;
JRGroup group = dataset.getResetGroup();
if (group != null)
{
groupName = group.getName();
group = (JRGroup)groupsMap.get(group.getName());
}
if (!ignoreConsistencyProblems && group == null)
{
throw new JRValidationException("Unknown reset group '" + groupName + "' for chart dataset.", dataset);
}
dataset.setResetGroup(group);
}
else
{
dataset.setResetGroup(null);
}
}
}