break;
}
}
}
if (l == null) {
throw new SaikuOlapException(
"Cannot find level " + level + " in hierarchy " + hierarchy + " of cube " + cube.getName());
}
if (isMondrian(nativeCube)) {
if (SaikuMondrianHelper.hasAnnotation(l, MondrianDictionary.SQLMEMBERLOOKUP)) {
if (search) {
ResultSet rs =
SaikuMondrianHelper.getSQLMemberLookup(con, MondrianDictionary.SQLMEMBERLOOKUP, l, searchString);
simpleMembers = ObjectUtil.convert2simple(rs);
LOG.debug("Found " + simpleMembers.size() + " members using SQL lookup for level " + level);
return simpleMembers;
} else {
return new ArrayList<SimpleCubeElement>();
}
}
}
if (search || searchLimit > 0) {
List<Member> foundMembers = new ArrayList<Member>();
for (Member m : l.getMembers()) {
if (search) {
if (m.getName().toLowerCase().contains(searchString) || m.getCaption().toLowerCase()
.contains(searchString)) {
foundMembers.add(m);
found++;
}
} else {
foundMembers.add(m);
found++;
}
if (searchLimit > 0 && found >= searchLimit) {
break;
}
}
simpleMembers = ObjectUtil.convert2Simple(foundMembers);
} else {
simpleMembers = ObjectUtil.convert2Simple(l.getMembers());
}
return simpleMembers;
}
} catch (Exception e) {
throw new SaikuOlapException("Cannot get all members", e);
}
return new ArrayList<SimpleCubeElement>();
}