int queryPos = 0;
q.setString(queryPos++, companyId);
q.setString(queryPos++, type);
com.liferay.portlet.admin.model.AdminConfig[] array = new com.liferay.portlet.admin.model.AdminConfig[3];
ScrollableResults sr = q.scroll();
if (sr.first()) {
while (true) {
AdminConfigHBM adminConfigHBM = (AdminConfigHBM)sr.get(0);
if (adminConfigHBM == null) {
break;
}
com.liferay.portlet.admin.model.AdminConfig curAdminConfig = AdminConfigHBMUtil.model(adminConfigHBM);
int value = obc.compare(adminConfig, curAdminConfig);
if (value == 0) {
if (!adminConfig.equals(curAdminConfig)) {
break;
}
array[1] = curAdminConfig;
if (sr.previous()) {
array[0] = AdminConfigHBMUtil.model((AdminConfigHBM)sr.get(
0));
}
sr.next();
if (sr.next()) {
array[2] = AdminConfigHBMUtil.model((AdminConfigHBM)sr.get(
0));
}
break;
}
if (count == 1) {
break;
}
count = (int)Math.ceil(count / 2.0);
if (value < 0) {
if (!sr.scroll(count * -1)) {
break;
}
}
else {
if (!sr.scroll(count)) {
break;
}
}
}
}