Examples of InvalidQueryException


Examples of javax.jcr.query.InvalidQueryException

                        ((Literal) expr).getLiteralValue().getString());
            } else if (expr instanceof BindVariableValueImpl) {
                Value value = this.bindVariables.get(
                        ((BindVariableValueImpl) expr).getBindVariableQName());
                if (value == null) {
                    throw new InvalidQueryException("Bind variable not bound");
                }
                return parser.parse(value.getString());
            } else {
                throw new RepositoryException(
                        "Unknown static operand type: " + expr);
View Full Code Here

Examples of javax.jcr.query.InvalidQueryException

                parser.ReInit(new StringReader(statement));
                query = parser.XPath2();
            }
            query.jjtAccept(this, root);
        } catch (ParseException e) {
            throw new InvalidQueryException(e.getMessage(), e);
        } catch (Throwable t) {
            // also catch any other exception
            throw new InvalidQueryException(t.getMessage(), t);
        }
        if (exceptions.size() > 0) {
            // simply report the first one
            Exception e = (Exception) exceptions.get(0);
            if (e instanceof InvalidQueryException) {
                // just re-throw
                throw (InvalidQueryException) e;
            } else {
                // otherwise package
                throw new InvalidQueryException(e.getMessage(), e);
            }
        }
    }
View Full Code Here

Examples of javax.jcr.query.InvalidQueryException

                    if (queryNode.getType() == QueryNode.TYPE_PATH) {
                        createLocationStep(node, (NAryQueryNode) queryNode);
                    } else if (queryNode.getType() == QueryNode.TYPE_TEXTSEARCH) {
                        // ignore
                    } else {
                        exceptions.add(new InvalidQueryException("Only attribute axis is allowed in predicate"));
                    }
                }
                break;
            case JJTNAMETEST:
                if (queryNode.getType() == QueryNode.TYPE_LOCATION
                        || queryNode.getType() == QueryNode.TYPE_DEREF
                        || queryNode.getType() == QueryNode.TYPE_RELATION
                        || queryNode.getType() == QueryNode.TYPE_TEXTSEARCH
                        || queryNode.getType() == QueryNode.TYPE_PATH) {
                    createNodeTest(node, queryNode);
                } else if (queryNode.getType() == QueryNode.TYPE_ORDER) {
                    createOrderSpec(node, (OrderQueryNode) queryNode);
                } else {
                    // traverse
                    node.childrenAccept(this, queryNode);
                }
                break;
            case JJTELEMENTNAMEORWILDCARD:
                if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                    SimpleNode child = (SimpleNode) node.jjtGetChild(0);
                    if (child.getId() != JJTANYNAME) {
                        createNodeTest(child, queryNode);
                    }
                }
                break;
            case JJTTEXTTEST:
                if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                    LocationStepQueryNode loc = (LocationStepQueryNode) queryNode;
                    loc.setNameTest(JCR_XMLTEXT);
                }
                break;
            case JJTTYPENAME:
                if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                    LocationStepQueryNode loc = (LocationStepQueryNode) queryNode;
                    String ntName = ((SimpleNode) node.jjtGetChild(0)).getValue();
                    try {
                        QName nt = NameFormat.parse(ntName, resolver);
                        NodeTypeQueryNode nodeType = new NodeTypeQueryNode(loc, nt);
                        loc.addPredicate(nodeType);
                    } catch (IllegalNameException e) {
                        exceptions.add(new InvalidQueryException("Not a valid name: " + ntName));
                    } catch (UnknownPrefixException e) {
                        exceptions.add(new InvalidQueryException("Unknown prefix in name: " + ntName));
                    }
                }
                break;
            case JJTOREXPR:
                NAryQueryNode parent = (NAryQueryNode) queryNode;
                queryNode = new OrQueryNode(parent);
                parent.addOperand(queryNode);
                // traverse
                node.childrenAccept(this, queryNode);
                break;
            case JJTANDEXPR:
                parent = (NAryQueryNode) queryNode;
                queryNode = new AndQueryNode(parent);
                parent.addOperand(queryNode);
                // traverse
                node.childrenAccept(this, queryNode);
                break;
            case JJTCOMPARISONEXPR:
                createExpression(node, (NAryQueryNode) queryNode);
                break;
            case JJTSTRINGLITERAL:
            case JJTDECIMALLITERAL:
            case JJTDOUBLELITERAL:
            case JJTINTEGERLITERAL:
                if (queryNode.getType() == QueryNode.TYPE_RELATION) {
                    assignValue(node, (RelationQueryNode) queryNode);
                } else if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                    if (node.getId() == JJTINTEGERLITERAL) {
                        int index = Integer.parseInt(node.getValue());
                        ((LocationStepQueryNode) queryNode).setIndex(index);
                    } else {
                        exceptions.add(new InvalidQueryException("LocationStep only allows integer literal as position index"));
                    }
                } else {
                    exceptions.add(new InvalidQueryException("Parse error: data is not a RelationQueryNode"));
                }
                break;
            case JJTUNARYMINUS:
                if (queryNode.getType() == QueryNode.TYPE_RELATION) {
                    ((RelationQueryNode) queryNode).setUnaryMinus(true);
                } else {
                    exceptions.add(new InvalidQueryException("Parse error: data is not a RelationQueryNode"));
                }
                break;
            case JJTFUNCTIONCALL:
                queryNode = createFunction(node, queryNode);
                break;
View Full Code Here

Examples of javax.jcr.query.InvalidQueryException

                    } else if (queryNode.getType() == QueryNode.TYPE_TEXTSEARCH) {
                        QName name = ISO9075.decode(NameFormat.parse(child.getValue(), resolver));
                        ((TextsearchQueryNode) queryNode).setPropertyName(name);
                    }
                } catch (IllegalNameException e) {
                    exceptions.add(new InvalidQueryException("Illegal name: " + child.getValue()));
                } catch (UnknownPrefixException e) {
                    exceptions.add(new InvalidQueryException("Unknown prefix: " + child.getValue()));
                }
            } else if (child.getId() == JJTSTAR) {
                if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                    ((LocationStepQueryNode) queryNode).setNameTest(null);
                }
            } else {
                exceptions.add(new InvalidQueryException("Unsupported location for name test: " + child));
            }
        }
    }
View Full Code Here

Examples of javax.jcr.query.InvalidQueryException

        } else if (opType.equals(OP_NE)) {
            type = RelationQueryNode.OPERATION_NE_VALUE;
        } else if (opType.equals(OP_SIGN_NE)) {
            type = RelationQueryNode.OPERATION_NE_GENERAL;
        } else {
            exceptions.add(new InvalidQueryException("Unsupported ComparisonExpr type:" + node.getValue()));
        }

        RelationQueryNode rqn = new RelationQueryNode(queryNode, type);

        // traverse
View Full Code Here

Examples of javax.jcr.query.InvalidQueryException

                queryNode.setPositionValue(Integer.parseInt(node.getValue()));
            } else {
                queryNode.setLongValue(Long.parseLong(node.getValue()));
            }
        } else {
            exceptions.add(new InvalidQueryException("Unsupported literal type:" + node.toString()));
        }
    }
View Full Code Here

Examples of net.sf.jz3950.query.model.InvalidQueryException

                // Consume the attribute token
                currentToken = readToken(tokenizer);
            }
            else
            {
                throw new InvalidQueryException("Unexpected error processing RPN query, expected attribute type");
            }

            // Ensure that there is an equals
            if (currentToken == PrefixQuery.TOKEN_EQUALS)
            {
                // Consume it
                currentToken = readToken(tokenizer);
            }
            else
            {
                throw new InvalidQueryException("Unexpected error processing RPN query, expected =");
            }

            // Ensure there is a value
            if (currentToken == PrefixQuery.TOKEN_NUMBER)
            {
                attributeValue = java.math.BigInteger.valueOf((int) tokenizer.nval);
                // Consume It
                currentToken = readToken(tokenizer);
            }
            else if (currentToken == PrefixQuery.TOKEN_TERM)
            {
                // With the new attribute set architecture we will start to get string values... Deal here
                attributeValue = tokenizer.sval;
                // Consume It
                currentToken = readToken(tokenizer);
            }
            else
            {
                throw new InvalidQueryException("Unexpected error processing RPN query, expected str or num attribute");
            }

            if (localAttributeSet == null)
            {
                localAttributeSet = namespaceId;
            }

            attributePlusTermNode.setAttribute(localAttributeSet + "." + attributeType, new AttributeValue(localAttributeSet, attributeType + "." + attributeValue));
        }

        // See if we have an element name
        if (currentToken == PrefixQuery.TOKEN_ELEMENTNAME)
        {
            // Consume the element name token and move on to the actual element name
            currentToken = readToken(tokenizer);

            // Consume the actual element name
            currentToken = readToken(tokenizer);
        }

        // Process any terms following the attrs
        while ((currentToken == PrefixQuery.TOKEN_TERM) || (currentToken == PrefixQuery.TOKEN_NUMBER))
        {
            if (currentToken == PrefixQuery.TOKEN_TERM)
            {
                terms.add(tokenizer.sval);
            }
            else
            {
                terms.add("" + tokenizer.nval);
            }

            currentToken = readToken(tokenizer);
        }

        if (terms.size() > 1)
        {
            attributePlusTermNode.setTerm(terms);
        }
        else if (terms.size() == 1)
        {
            attributePlusTermNode.setTerm(terms.get(0));
        }
        else
        {
            throw new InvalidQueryException("No Terms");
        }

        return attributePlusTermNode;
    }
View Full Code Here

Examples of nexj.core.persistence.InvalidQueryException

         nFlags |= NORMALIZE_NORECUR;
      }

      if (!m_right.isConstant())
      {
         throw new InvalidQueryException("err.persistence.variableLikePattern");
      }

      return super.normalize(nFlags);
   }
View Full Code Here

Examples of org.apache.ambari.server.api.predicate.InvalidQueryException

  }

  @Override
  public Predicate toPredicate(String prop, String val) throws InvalidQueryException {
    if (val == null) {
      throw new InvalidQueryException("Filter operator is missing a required right operand.");
    }
    return new FilterPredicate(prop, val);
  }
View Full Code Here

Examples of org.apache.slide.search.InvalidQueryException

     *
     */
    protected String  getLiteral(Element e) throws InvalidQueryException {
        Element lit = e.getChild (Literals.LITERAL, NamespaceCache.DEFAULT_NAMESPACE);
        if (lit == null)
            throw new InvalidQueryException
                ("No literal element supplied");
       
        return lit.getText ();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.