Search in sources :

Example 1 with ConstantCondition

use of com.evolveum.midpoint.repo.sql.query.hqm.condition.ConstantCondition in project midpoint by Evolveum.

the class PropertyRestriction method interpretInternal.

@Override
public Condition interpretInternal() throws QueryException {
    JpaPropertyDefinition propertyDefinition = linkDefinition.getTargetDefinition();
    if (propertyDefinition.isLob()) {
        throw new QueryException("Can't query based on clob property value '" + linkDefinition + "'.");
    }
    String propertyValuePath = getHqlDataInstance().getHqlPath();
    if (filter.getRightHandSidePath() != null) {
        return createPropertyVsPropertyCondition(propertyValuePath);
    } else {
        Object value = getValueFromFilter(filter);
        if (value == null && propertyDefinition.isNeverNull()) {
            LOGGER.warn("Checking nullity of non-null property {} (filter = {})", propertyDefinition, filter);
            return new ConstantCondition(context.getHibernateQuery(), false);
        } else {
            Condition condition = createPropertyVsConstantCondition(propertyValuePath, value, filter);
            return addIsNotNullIfNecessary(condition, propertyValuePath);
        }
    }
}
Also used : ConstantCondition(com.evolveum.midpoint.repo.sql.query.hqm.condition.ConstantCondition) Condition(com.evolveum.midpoint.repo.sql.query.hqm.condition.Condition) QueryException(com.evolveum.midpoint.repo.sqlbase.QueryException) ConstantCondition(com.evolveum.midpoint.repo.sql.query.hqm.condition.ConstantCondition) JpaPropertyDefinition(com.evolveum.midpoint.repo.sql.query.definition.JpaPropertyDefinition) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Aggregations

PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 JpaPropertyDefinition (com.evolveum.midpoint.repo.sql.query.definition.JpaPropertyDefinition)1 Condition (com.evolveum.midpoint.repo.sql.query.hqm.condition.Condition)1 ConstantCondition (com.evolveum.midpoint.repo.sql.query.hqm.condition.ConstantCondition)1 QueryException (com.evolveum.midpoint.repo.sqlbase.QueryException)1