}
public static CrosstabBuilder populateBuilder(final CrosstabGroup editedGroup,
final ContextAwareDataSchemaModel reportDataSchemaModel)
{
CrosstabCellBody cellBody = null;
Group group = editedGroup.getBody().getGroup();
ArrayList<CrosstabRowGroup> rows = new ArrayList<CrosstabRowGroup>();
ArrayList<CrosstabColumnGroup> cols = new ArrayList<CrosstabColumnGroup>();
ArrayList<CrosstabOtherGroup> others = new ArrayList<CrosstabOtherGroup>();
while (group != null)
{
if (group instanceof CrosstabOtherGroup)
{
CrosstabOtherGroup otherGroup = (CrosstabOtherGroup) group;
others.add(otherGroup);
}
else if (group instanceof CrosstabRowGroup)
{
CrosstabRowGroup rowGroup = (CrosstabRowGroup) group;
rows.add(rowGroup);
}
else if (group instanceof CrosstabColumnGroup)
{
CrosstabColumnGroup colGroup = (CrosstabColumnGroup) group;
cols.add(colGroup);
}
else
{
break;
}
GroupBody body = group.getBody();
if (body instanceof CrosstabCellBody)
{
cellBody = (CrosstabCellBody) body;
break;
}
group = body.getGroup();
}
if (cellBody == null)
{
throw new IllegalStateException("A crosstab group can never be without a cell body");
}
LinkedHashMap<String, DetailsDefinition> details;
CrosstabCell element = cellBody.findElement(null, null);
if (element != null)
{
details = extractFromDetailCell(element, cellBody.getHeader());
}
else
{
details = new LinkedHashMap<String, DetailsDefinition>();
}