Search in sources :

Example 46 with QueryException

use of com.evolveum.midpoint.repo.sqlbase.QueryException in project midpoint by Evolveum.

the class JpaEntityDefinition method nextLinkDefinition.

@Override
public DataSearchResult<?> nextLinkDefinition(ItemPath path, ItemDefinition<?> itemDefinition, PrismContext prismContext) throws QueryException {
    if (ItemPath.isEmpty(path)) {
        // doesn't fulfill precondition
        return null;
    }
    Object first = path.first();
    if (ItemPath.isId(first)) {
        throw new QueryException("ID item path segments are not allowed in query: " + path);
    } else if (ItemPath.isObjectReference(first)) {
        throw new QueryException("'@' path segment cannot be used in the context of an entity " + this);
    }
    JpaLinkDefinition<?> link = findRawLinkDefinition(path, JpaDataNodeDefinition.class, false);
    if (link == null) {
        return null;
    } else {
        link.resolveEntityPointer();
        return new DataSearchResult<>(link, path.rest(link.getItemPath().size()));
    }
}
Also used : QueryException(com.evolveum.midpoint.repo.sqlbase.QueryException) DataSearchResult(com.evolveum.midpoint.repo.sql.query.resolution.DataSearchResult) RObject(com.evolveum.midpoint.repo.sql.data.common.RObject)

Aggregations

QueryException (com.evolveum.midpoint.repo.sqlbase.QueryException)46 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)9 QName (javax.xml.namespace.QName)9 RootHibernateQuery (com.evolveum.midpoint.repo.sql.query.hqm.RootHibernateQuery)8 Predicate (com.querydsl.core.types.Predicate)8 QueryEngine (com.evolveum.midpoint.repo.sql.query.QueryEngine)6 PropertyValueFilter (com.evolveum.midpoint.prism.query.PropertyValueFilter)5 RQuery (com.evolveum.midpoint.repo.sql.query.RQuery)5 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 Condition (com.evolveum.midpoint.repo.sql.query.hqm.condition.Condition)4 FilterOperation (com.evolveum.midpoint.repo.sqlbase.filtering.item.FilterOperation)4 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)4 RPolyString (com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString)3 HqlDataInstance (com.evolveum.midpoint.repo.sql.query.resolution.HqlDataInstance)3 RepositoryException (com.evolveum.midpoint.repo.sqlbase.RepositoryException)3 ItemRelationResolver (com.evolveum.midpoint.repo.sqlbase.mapping.ItemRelationResolver)3 NotNull (org.jetbrains.annotations.NotNull)3 EqualFilter (com.evolveum.midpoint.prism.query.EqualFilter)2 ValueFilter (com.evolveum.midpoint.prism.query.ValueFilter)2 ExtensionProcessor (com.evolveum.midpoint.repo.sqale.ExtensionProcessor)2