final Cube cube,
final String parameter) throws ReportDataFactoryException
{
try
{
final Member directValue = yuckyInternalMondrianLookup(query, hierarchy, parameter);
if (directValue != null)
{
return directValue;
}
}
catch (Exception e)
{
// It is non fatal if that fails. Invalid input has this effect.
}
Member memberById = null;
Member memberByUniqueId = null;
final boolean searchForNames = MondrianProperties.instance().NeedDimensionPrefix.get() == false;
final boolean missingMembersIsFatal = MondrianProperties.instance().IgnoreInvalidMembersDuringQuery.get();
try
{
final Member directValue = lookupDirectly(hierarchy, cube, parameter, searchForNames);
if (directValue != null)
{
return directValue;
}
}
catch (Exception e)
{
// It is non fatal if that fails. Invalid input has this effect.
}
final Query memberQuery = connection.parseQuery("SELECT " + hierarchy.getQualifiedName() // NON-NLS
+ ".AllMembers ON 0, {} ON 1 FROM " + cube.getQualifiedName()); // NON-NLS
final Result result = connection.execute(memberQuery);
try
{
final List<Position> positionList = result.getAxes()[0].getPositions();
for (int i = 0; i < positionList.size(); i++)
{
final Position position = positionList.get(i);
for (int j = 0; j < position.size(); j++)
{
final Member member = position.get(j);
if (parameter.equals(MondrianUtil.getUniqueMemberName(member)))
{
if (memberByUniqueId == null)
{
memberByUniqueId = member;
}
else
{
logger.warn("Encountered a member with a duplicate unique key: " + member.getQualifiedName()); // NON-NLS
}
}
if (searchForNames == false)
{
continue;
}
if (parameter.equals(member.getName()))
{
if (memberById == null)
{
memberById = member;
}
else
{
logger.warn("Encountered a member with a duplicate name: " + member.getQualifiedName()); // NON-NLS
}
}
}
}
}