int size = parentRows.size();
if (size > 0) {
int rowIndex = 0;
for (int i = 0; i < size -1; i++) {
rowIndex = i;
RowData parentRow = parentRows.get(i);
childQuery += populateChildInputs(rowIndex, childIp.getInputs(), parentRow, query) + " UNION ";
}
//last row
rowIndex = size -1;
RowData parentRow = (RowData)parentRows.get(rowIndex);
childQuery += populateChildInputs(rowIndex, childIp.getInputs(), parentRow, query);
}
}
else
if (InputInfo.CONSTRUCT_CHILD_QUERY_MAKE_NEW_WHERE_CLAUSE.equals(childIp.getChildQueryType())) {
int size = parentRows.size();
if (size > 0) {
String conditionPart1 = "(" + childIp.getFKString() + ") in ";
String conditionPart2 = "";
int rowIndex = 0;
for (int i = 0; i < size -1; i++) {
rowIndex = i;
RowData parentRow = parentRows.get(i);
conditionPart2 += populateConditionPart2(rowIndex, childIp, parentRow) + ", ";
}
//last row
rowIndex = size -1;
RowData parentRow = parentRows.get(rowIndex);
conditionPart2 += populateConditionPart2(rowIndex, childIp, parentRow);
childQuery += " WHERE " + conditionPart1 + "(" + conditionPart2 + ")";
}
}
else
if (InputInfo.CONSTRUCT_CHILD_QUERY_ADD_TO_WHERE_CLAUSE.equals(childIp.getChildQueryType())) {
int size = parentRows.size();
if (size > 0) {
String conditionPart1 = "(" + childIp.getFKString() + ") in ";
String conditionPart2 = "";
int rowIndex = 0;
for (int i = 0; i < size -1; i++) {
rowIndex = i;
RowData parentRow = (RowData)parentRows.get(i);
conditionPart2 += populateConditionPart2(rowIndex, childIp, parentRow) + ", ";
}
//last row
rowIndex = size -1;
RowData parentRow = (RowData)parentRows.get(rowIndex);
conditionPart2 += populateConditionPart2(rowIndex, childIp, parentRow);
childQuery += " AND " + conditionPart1 + "(" + conditionPart2 + ")";
}
}