protected void processAggregateElement(final ReportElement element,
final Class<AggregationFunction> aggType)
throws InstantiationException, IllegalAccessException, ReportProcessingException
{
final AggregationFunction o = aggType.newInstance();
if (configureCrosstabAggregation(element, o) == false)
{
configureRelationalAggreation(element, o);
}
final String fieldName = (String) element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD);
if (o instanceof FieldAggregationFunction)
{
final FieldAggregationFunction fo = (FieldAggregationFunction) o;
fo.setField(fieldName);
}
final Object labelFor =
element.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR);
if (labelFor == null)
{
element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, fieldName);
}
final String name = AutoGeneratorUtility.generateUniqueExpressionName
(schema, "::wizard:aggregation:{0}",
generatedExpressionNames.toArray(new String[generatedExpressionNames.size()]));
o.setName(name);
generatedExpressionNames.add(name);
element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, name);
// finally clean up
element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, null);