final ModifiableReportParameterDefinition mdef = (ModifiableReportParameterDefinition) definition;
final int count = mdef.getParameterCount();
for (int i = 0; i < count; i++)
{
final ParameterDefinitionEntry definitionEntry = mdef.getParameterDefinition(i);
if (definitionEntry == data)
{
try
{
return definitionEntry.clone();
}
catch (CloneNotSupportedException e)
{
UncaughtExceptionsModel.getInstance().addException(e);
return null;
}
}
}
return null;
}
if (data instanceof Expression)
{
final AbstractReportDefinition report = context.getReportDefinition();
final ExpressionCollection expressionCollection = report.getExpressions();
final int count = expressionCollection.size();
for (int i = 0; i < count; i++)
{
final Expression definitionEntry = expressionCollection.getExpression(i);
if (definitionEntry == data)
{
return definitionEntry.getInstance();
}
}
return null;
}