private static MasterReport findMasterReport(final AbstractReportDefinition def)
{
AbstractReportDefinition loopDef = def;
while (loopDef instanceof MasterReport == false)
{
final Section parentSection = def.getParentSection();
if (parentSection == null)
{
break;
}
loopDef = (AbstractReportDefinition) parentSection.getReportDefinition();
}
if (loopDef instanceof MasterReport)
{
return (MasterReport) def;