while (it.hasNext()) {
String assocType = (String) it.next();
expr = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.EQUALS, assocType);
exprListOr.add(expr);
}
EntityConditionList assocExprList = EntityCondition.makeCondition(exprListOr, EntityOperator.OR);
exprList.add(assocExprList);
}
if (fromDate != null) {
EntityExpr fromExpr = EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate);
exprList.add(fromExpr);
}
if (thruDate != null) {
List thruList = new ArrayList();
//thruDate = UtilDateTime.getDayStart(thruDate, daysLater);
EntityExpr thruExpr = EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN, thruDate);
thruList.add(thruExpr);
EntityExpr thruExpr2 = EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null);
thruList.add(thruExpr2);
EntityConditionList thruExprList = EntityCondition.makeCondition(thruList, EntityOperator.OR);
exprList.add(thruExprList);
} else if (fromDate != null) {
List thruList = new ArrayList();
EntityExpr thruExpr = EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, fromDate);
thruList.add(thruExpr);
EntityExpr thruExpr2 = EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null);
thruList.add(thruExpr2);
EntityConditionList thruExprList = EntityCondition.makeCondition(thruList, EntityOperator.OR);
exprList.add(thruExprList);
} else {
EntityExpr thruExpr2 = EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null);
exprList.add(thruExpr2);
}
EntityConditionList assocExprList = EntityCondition.makeCondition(exprList, EntityOperator.AND);
//if (Debug.infoOn()) Debug.logInfo(" assocExprList:" + assocExprList , "");
List relatedAssocs = delegator.findList("ContentAssoc", assocExprList, null, UtilMisc.toList("-fromDate"), null, false);
//if (Debug.infoOn()) Debug.logInfo(" relatedAssoc:" + relatedAssocs.size() , "");
//for (int i = 0; i < relatedAssocs.size(); i++) {
//GenericValue a = (GenericValue) relatedAssocs.get(i);