Package com.dottydingo.hyperion.exception

Examples of com.dottydingo.hyperion.exception.BadRequestException


            queryTree = RSQLParser.parse(query);

        }
        catch (ParseException ex)
        {
            throw new BadRequestException("Error parsing query.", ex);
        }
        catch (TokenMgrError er)
        {
            throw new BadRequestException("Invalid query", er);
        }
        return new InternalPredicateBuilder(entityPlugin.getQueryBuilders(),queryTree);


    }
View Full Code Here


            if (expression.isComparison())
            {
                return buildPredicate((ComparisonExpression) expression,entityRoot,cb);
            }

            throw new BadRequestException("Invalid expression.");
        }
View Full Code Here

                case OR:
                    return cb.or(
                            buildPredicate(logical.getLeft(),entityRoot,cb),
                            buildPredicate(logical.getRight(),entityRoot,cb));
            }
            throw new BadRequestException("Invalid expression.");
        }
View Full Code Here

        private Predicate buildPredicate(ComparisonExpression comparison,  Root entityRoot, CriteriaBuilder cb)
        {
            QueryBuilder qb = queryBuilders.get(comparison.getSelector());
            if(qb == null)
                throw new BadRequestException(String.format("Can not query by %s",comparison.getSelector()));

            return qb.buildPredicate(entityRoot,cb,comparison.getOperator(),comparison.getArgument());
        }
View Full Code Here

     * @return Criterion
     */
    protected Predicate createGreaterThan(Path root, CriteriaBuilder cb,String propertyPath, Object argument)
    {
        if(!(argument instanceof Comparable))
            throw new BadRequestException(String.format("Incompatible query operation: %s.","gt"));

        return cb.greaterThan(root.get(propertyPath), (Comparable) argument);
    }
View Full Code Here

     * @return Criterion
     */
    protected Predicate createGreaterEqual(Path root, CriteriaBuilder cb,String propertyPath, Object argument)
    {
        if(!(argument instanceof Comparable))
            throw new BadRequestException(String.format("Incompatible query operation: %s.","ge"));

        return cb.greaterThanOrEqualTo(root.get(propertyPath), (Comparable) argument);
    }
View Full Code Here

     * @return Criterion
     */
    protected Predicate createLessThan(Path root, CriteriaBuilder cb,String propertyPath, Object argument)
    {
        if(!(argument instanceof Comparable))
            throw new BadRequestException(String.format("Incompatible query operation: %s.","lt"));

        return cb.lessThan(root.get(propertyPath), (Comparable) argument);
    }
View Full Code Here

     * @return Criterion
     */
    protected Predicate createLessEqual(Path root, CriteriaBuilder cb,String propertyPath, Object argument)
    {
        if(!(argument instanceof Comparable))
            throw new BadRequestException(String.format("Incompatible query operation: %s.","le"));

        return cb.lessThanOrEqualTo(root.get(propertyPath), (Comparable) argument);
    }
View Full Code Here

        {
            return Integer.parseInt(value);
        }
        catch (NumberFormatException e)
        {
            throw new BadRequestException(String.format("%s must be an integer.",name));
        }
    }
View Full Code Here

        RequestContext<ApiObject> requestContext = marshaller.unmarshallWithContext(request.getInputStream(), apiVersionPlugin.getApiClass());
        ApiObject clientObject = requestContext.getRequestObject();

        List ids = plugin.getKeyConverter().covertKeys(phaseContext.getId());
        if(ids.size() != 1)
            throw new BadRequestException("A single id must be provided for an update.");

        Set<String> setFields = requestContext.getSetFields();

        persistenceContext.setProvidedFields(setFields);
View Full Code Here

TOP

Related Classes of com.dottydingo.hyperion.exception.BadRequestException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.