Package org.apache.slide.search

Examples of org.apache.slide.search.BadQueryException


        this.factory = factory;
        Iterator it = children.iterator();
        BasicExpressionSample firstChild = (BasicExpressionSample)it.next();

        if (firstChild == null)
            throw new BadQueryException (mergeOperator + " needs at least one nested element");

        theExecutableCommand = firstChild.theExecutableCommand;

        // create the executable command
        while (it.hasNext()) {
View Full Code Here


        // <where> is not mandatory
        if (whereElement != null) {
            List expressionList = whereElement.getChildren();
            if (expressionList.size() != 1) {
                throw new BadQueryException ("where must have exactly one nested element");
            }

            Element whereWithoutNot =
                notNormalizer.getQueryWithoutNotExpression((Element)expressionList.get (0));
            rootExpression = expressionCompiler.compile(whereWithoutNot);
View Full Code Here

     *
     */
    public static QueryScope getScope(Element basicSearchElementJDOM)
        throws BadQueryException {
        if (basicSearchElementJDOM == null)
            throw new BadQueryException (NO_QUERY_ELEMENT);

        Namespace namespace = basicSearchElementJDOM.getNamespace();
        Element fromElement = basicSearchElementJDOM.getChild
            (Literals.FROM, namespace);

        // FROM is mandatory
        if (fromElement == null)
            throw new BadQueryException (FROM_ELEMENT_MISSING);

        return new BasicQueryScope (fromElement);
    }
View Full Code Here

     */
    protected void parseQueryWithoutExpression (Element basicSearchElement)
        throws BadQueryException {

        if (basicSearchElement == null)
            throw new BadQueryException (NO_QUERY_ELEMENT);

        namespace = basicSearchElement.getNamespace();

        Element selectElement = basicSearchElement.getChild
            (Literals.SELECT, namespace);

        // SELECT is mandatory
        if (selectElement == null)
            throw new BadQueryException (SELECT_ELEMENT_MISSING);

        Element fromElement = basicSearchElement.getChild
            (Literals.FROM, namespace);

        // FROM is mandatory
        if (fromElement == null) {
            throw new BadQueryException (FROM_ELEMENT_MISSING);
        }

        whereElement = basicSearchElement.getChild
            (Literals.WHERE, namespace);

        Element orderByElement = basicSearchElement.getChild
            (Literals.ORDERBY, namespace);

        Element limitElement = basicSearchElement.getChild
            (Literals.LIMIT, namespace);

        Element propElement = selectElement.getChild (Literals.PROP, namespace);
        if (propElement == null) {
            propElement = selectElement.getChild (Literals.ALLPROP, namespace);
        }

        if (propElement == null) {
            throw new BadQueryException(PROP_OR_ALLPROP_ELEMENT_MISSING);
        }

        requestedProperties = createRequestedProperties (propElement);

        //queryScope = new BasicQueryScope (fromElement);

        if (orderByElement != null) {
            orderBy = createNewOrderBy (orderByElement);
        }

        if (limitElement != null) {
            Element nResElem = limitElement.getChild (Literals.NRESULTS, namespace);
            if (nResElem == null)
                throw new BadQueryException (NRESULTS_MISSING);

            limit = new Integer (nResElem.getTextTrim()).intValue();
            limitDefined = true;
        }
    }
View Full Code Here

    protected RequestedProperties createRequestedProperties (Element propElement) throws BadQueryException {
        try {
            return new RequestedPropertiesImpl (propElement);
        }
        catch (PropertyParseException e) {
            throw new BadQueryException (e.getMessage(), e);
        }
    }
View Full Code Here

            Element root = doc.getRootElement();
            return parseQuery(root, token, propertyProvider);
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new BadQueryException (e.getMessage());
        }
    }
View Full Code Here

     * @throws   BadQueryException
     */
    protected void parseQueryWithoutExpression (Element basicSearchElement) throws BadQueryException {

        if (basicSearchElement == null)
            throw new BadQueryException (NO_QUERY_ELEMENT);

        namespace = basicSearchElement.getNamespace();

        Element selectElement = basicSearchElement.getChild
            (Literals.SELECT, namespace);

        // SELECT is mandatory
        if (selectElement == null)
            throw new BadQueryException (SELECT_ELEMENT_MISSING);

        Element fromElement = basicSearchElement.getChild
            (Literals.FROM, namespace);

        // FROM is mandatory
        if (fromElement == null) {
            throw new BadQueryException (FROM_ELEMENT_MISSING);
        }

        whereElement = basicSearchElement.getChild
            (Literals.WHERE, namespace);

        Element orderByElement = basicSearchElement.getChild
            (Literals.ORDERBY, namespace);

        Element limitElement = basicSearchElement.getChild
            (Literals.LIMIT, namespace);

        Element propElement = selectElement.getChild (Literals.PROP, namespace);
        if (propElement == null) {
            propElement = selectElement.getChild (Literals.ALLPROP, namespace);
        }

        if (propElement == null) {
            throw new BadQueryException(PROP_OR_ALLPROP_ELEMENT_MISSING);
        }

        try {
            requestedProperties = new RequestedPropertiesImpl (propElement);
        }
        catch (PropertyParseException e) {
            throw new BadQueryException(e.getMessage(), e);
        }

        queryScope = new BasicQueryScope (fromElement);

        if (orderByElement != null) {
View Full Code Here

     */
    public static QueryScope getScope(Element basicSearchElementJDOM)
        throws BadQueryException
    {
        if (basicSearchElementJDOM == null)
            throw new BadQueryException (NO_QUERY_ELEMENT);

        Namespace namespace = basicSearchElementJDOM.getNamespace();
        Element fromElement = basicSearchElementJDOM.getChild
            (Literals.FROM, namespace);

        // FROM is mandatory
        if (fromElement == null)
            throw new BadQueryException (FROM_ELEMENT_MISSING);

        return new BasicQueryScope (fromElement);
    }
View Full Code Here

        catch (StructureException e) {
            throw new InvalidScopeException
                ("scope " + resourceUri + " is invalid");
        }
        catch (Exception e) {
            throw new BadQueryException (e.getMessage());
        }
    }
View Full Code Here

        Namespace namespace  = fromElement.getNamespace();
        String name = fromElement.getName ();
       
        if (! (namespace.getURI().equals (NodeProperty.DEFAULT_NAMESPACE)
                   && name.equals (Literals.FROM)))
            throw new BadQueryException ("expected DAV:from");
       
        Element scope = fromElement.getChild (Literals.SCOPE, namespace);
       
        if (scope.getChildren (Literals.HREF, namespace).size() != 1) {
            throw new BadQueryException ("exactly one href element must be defined");
        }
       
        href  = scope.getChildTextTrim (Literals.HREF, namespace);
       
        try {
View Full Code Here

TOP

Related Classes of org.apache.slide.search.BadQueryException

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.