int i = 0;
for(Iterator<ExtendedCondition> iterator = conditions.iterator(); iterator.hasNext();) {
ExtendedCondition extendedCondition = iterator.next();
String attribute = extendedCondition.getAttribute();
int position = LogModule.getUserPropertyPosition(attribute);
Operator operator = extendedCondition.getOperator();
String value = extendedCondition.getValue();
// Is position equal to 0 then the list userProperties doesn't contain the value of attribute.
if (position > 0 && operator.buildSQLStatement(attribute, value).length() > 0) {
values[i] = value;
String connection = "";
if(!firstIteration) {
connection = " " + (hasANDConnection?"AND":"OR") + " ";
}
query = query.concat(connection + operator.buildSQLStatement("v.userProperty"+position, ":value"+i));
i++;
}
if (firstIteration) firstIteration = false;
}
query = query.concat(")");