{
Member memberById = null;
Member memberByUniqueId = null;
final Query queryDirect = connection.parseQuery("SELECT STRTOMEMBER(" + quote(parameter) + ") ON 0, {} ON 1 FROM " // NON-NLS
+ cube.getQualifiedName());
final Result resultDirect = connection.execute(queryDirect);
try
{
final List<Position> positionList = resultDirect.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 the parameter starts with '[', we'll assume we have the full
// member specification specification. Otherwise, keep the funky lookup
// route. We do check whether we get a second member (heck, should not
// happen, but I've seen pigs fly already).
if (parameter.startsWith("["))
{
if (memberByUniqueId == null)
{
memberByUniqueId = member;
}
else
{
logger.warn("Encountered a member with a duplicate 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
}
}
}
}
}
finally
{
resultDirect.close();
}
if (memberByUniqueId != null)
{
final Hierarchy memberHierarchy = memberByUniqueId.getHierarchy();
if (hierarchy != memberHierarchy)