final ReportDataSchemaModel model = reportContext.getReportDataSchemaModel();
final String[] columnNames = model.getColumnNames();
final String[] extraFields = getExtraFields();
final ArrayList<FieldDefinition> fields = new ArrayList<FieldDefinition>(columnNames.length + extraFields.length);
final DataSchema dataSchema = model.getDataSchema();
for (int i = 0; i < extraFields.length; i++)
{
final String extraField = extraFields[i];
fields.add(new DataSchemaFieldDefinition(extraField, new EmptyDataAttributes(), dataAttributeContext));
}
for (int i = columnNames.length - 1; i >= 0; i -= 1)
{
final String columnName = columnNames[i];
final DataAttributes attributes = dataSchema.getAttributes(columnName);
if (attributes == null)
{
throw new IllegalStateException("No data-schema for field with name '" + columnName + '\'');
}
if (ReportDataSchemaModel.isFiltered(attributes, dataAttributeContext))