Search in sources :

Example 1 with IsNotNullCondition

use of com.evolveum.midpoint.repo.sql.query2.hqm.condition.IsNotNullCondition in project midpoint by Evolveum.

the class ItemValueRestriction method addIsNotNullIfNecessary.

/**
     * Filter of type NOT(PROPERTY=VALUE) causes problems when there are entities with PROPERTY set to NULL.
     *
     * Such a filter has to be treated like
     *
     *      NOT (PROPERTY=VALUE & PROPERTY IS NOT NULL)
     *
     * TODO implement for restrictions other than PropertyRestriction.
     */
protected Condition addIsNotNullIfNecessary(Condition condition, String propertyPath) {
    if (condition instanceof IsNullCondition || condition instanceof IsNotNullCondition) {
        return condition;
    }
    if (!isNegated()) {
        return condition;
    }
    RootHibernateQuery hibernateQuery = getContext().getHibernateQuery();
    AndCondition conjunction = hibernateQuery.createAnd();
    conjunction.add(condition);
    conjunction.add(hibernateQuery.createIsNotNull(propertyPath));
    return conjunction;
}
Also used : IsNotNullCondition(com.evolveum.midpoint.repo.sql.query2.hqm.condition.IsNotNullCondition) RootHibernateQuery(com.evolveum.midpoint.repo.sql.query2.hqm.RootHibernateQuery) IsNullCondition(com.evolveum.midpoint.repo.sql.query2.hqm.condition.IsNullCondition) AndCondition(com.evolveum.midpoint.repo.sql.query2.hqm.condition.AndCondition)

Aggregations

RootHibernateQuery (com.evolveum.midpoint.repo.sql.query2.hqm.RootHibernateQuery)1 AndCondition (com.evolveum.midpoint.repo.sql.query2.hqm.condition.AndCondition)1 IsNotNullCondition (com.evolveum.midpoint.repo.sql.query2.hqm.condition.IsNotNullCondition)1 IsNullCondition (com.evolveum.midpoint.repo.sql.query2.hqm.condition.IsNullCondition)1