if(userCrit == null) {
return FALSE_CRITERIA;
}
// get the CriteriaSelector, elements on the selector and the selector type
CriteriaSelector selector = hasCrit.getSelector();
Collection hasCritElmts = null;
if(selector.hasElements()) {
hasCritElmts = selector.getElements();
// collect elements present on the user's criteria and check if
// all of the hasCriteria elements are among them
Collection<ElementSymbol> userElmnts = ElementCollectorVisitor.getElements(userCrit, true);
if(!userElmnts.containsAll(hasCritElmts)) {
return FALSE_CRITERIA;
}
}
int selectorType = selector.getSelectorType();
// if no selector type specified return true
// already checked all HAS elements present on user criteria
if(selectorType == CriteriaSelector.NO_TYPE) {
return TRUE_CRITERIA;
}
// collect all predicate criteria present on the user's criteria
for (Criteria predicateCriteria : Criteria.separateCriteriaByAnd(userCrit)) {
// atleast one of the hasElemnets should be on this predicate else
// proceed to the next predicate
Collection<ElementSymbol> predElmnts = ElementCollectorVisitor.getElements(predicateCriteria, true);
if(selector.hasElements()) {
Iterator hasIter = hasCritElmts.iterator();
boolean containsElmnt = false;
while(hasIter.hasNext()) {
ElementSymbol hasElmnt = (ElementSymbol) hasIter.next();
if(predElmnts.contains(hasElmnt)) {