@Override
public String getCriteriaItemClause(ViewCriteriaItem vci) {
if (vci.getAttributeDef().getName().equals("DepartmentName") &&
vci.getViewCriteria().getName().contains("DeptSampleVC")) {
if (vci.getViewCriteria().getRootViewCriteria().isCriteriaForQuery()) {
return getINClauseForDatabaseUse(vci);
} else {
return getINClauseForCache(vci);
}
} else {
return super.getCriteriaItemClause(vci);
}
}
protected String getINClauseForDatabaseUse(ViewCriteriaItem vci) {
String bindVarValue = getCommaDelimitedDeptNames();
String bindVarName = "CommaDelimitedDeptNames";
String whereCluase = "1=1";
if (bindVarValue != null && bindVarValue.trim().length() != 0) {
whereCluase =
this.getEntityDef(0).getAliasName() + ".DEPARTMENT_NAME IN (select /*+ CARDINALITY(A, 50) */ * from TABLE (cast (in_list_char ( :" +
bindVarName + " ) as ChartableType))A)";
}
return whereCluase;
}
protected String getINClauseForCache(ViewCriteriaItem vci) {
String whereCluase = "1=1";
return whereCluase;
}