*/
public void initialize(ReportQuery query) throws QueryException {
int size= getReportItems().size();
List mappings = new ArrayList();
for (int index = 0; index < size; index++) {
ReportItem item = (ReportItem)reportItems.get(index);
item.initialize(query);
mappings.add(item.getMapping());
}
setConstructorMappings(mappings);
int numberOfItems = getReportItems().size();
// Arguments may be initialized depending on how the query was constructed, so types may be undefined though.
if (getConstructorArgTypes() == null) {
setConstructorArgTypes(new Class[numberOfItems]);
}
Class[] constructorArgTypes = getConstructorArgTypes();
for (int index = 0; index < numberOfItems; index++) {
if (constructorArgTypes[index] == null) {
ReportItem argumentItem = (ReportItem)getReportItems().get(index);
if (mappings.get(index) != null) {
DatabaseMapping mapping = (DatabaseMapping)constructorMappings.get(index);
if (argumentItem.getAttributeExpression() != null && argumentItem.getAttributeExpression().isMapEntryExpression()){
if (((MapEntryExpression)argumentItem.getAttributeExpression()).shouldReturnMapEntry()){
constructorArgTypes[index] = Map.Entry.class;
} else {
constructorArgTypes[index] = (Class)((CollectionMapping)mapping).getContainerPolicy().getKeyType();
}
} else {
constructorArgTypes[index] = mapping.getAttributeClassification();
}
} else if (argumentItem.getResultType() != null) {
constructorArgTypes[index] = argumentItem.getResultType();
} else if (argumentItem.getDescriptor() != null) {
constructorArgTypes[index] = argumentItem.getDescriptor().getJavaClass();
} else if (argumentItem.getAttributeExpression() != null && argumentItem.getAttributeExpression().isConstantExpression()){
constructorArgTypes[index] = ((ConstantExpression)argumentItem.getAttributeExpression()).getValue().getClass();
} else {
// Use Object.class by default.
constructorArgTypes[index] = ClassConstants.OBJECT;
}
}