private StaticOperand checkFullTextSearchExpression(StaticOperand fullTextSearchExpression) throws RepositoryException { if (fullTextSearchExpression == null) { throw new InvalidQueryException( "fullTextSearchExpression must not be null"); } return fullTextSearchExpression; } }
@Override public QueryImpl createQuery(String statement, String language) throws RepositoryException { if (!supportedQueryLanguages.contains(language)) { throw new InvalidQueryException("The specified language is not supported: " + language); } return new QueryImpl(this, statement, language, sessionContext); }
private Name checkPropertyName(String propertyName) throws RepositoryException { if (propertyName == null) { throw new InvalidQueryException("propertyName must not be null"); } try { return resolver.getQName(propertyName); } catch (NameException e) { throw new InvalidQueryException(e.getMessage()); } }
private QueryFormat(QueryRootNode root, LocationFactory resolver) throws RepositoryException { this.resolver = resolver; statement = root.accept(this, new StringBuilder()).toString(); if (exceptions.size() > 0) { Exception e = (Exception) exceptions.get(0); throw new InvalidQueryException(e.getMessage(), e); } }
public Object visit(PropertyFunctionQueryNode node, Object data) { StringBuilder sb = (StringBuilder) data; String functionName = node.getFunctionName(); if (functionName.equals(PropertyFunctionQueryNode.LOWER_CASE)) { sb.insert(0, "LOWER(").append(")"); } else if (functionName.equals(PropertyFunctionQueryNode.UPPER_CASE)) { sb.insert(0, "UPPER(").append(")"); } else { exceptions.add(new InvalidQueryException("Unsupported function: " + functionName)); } return sb; }
public Object visit(PropertyFunctionQueryNode node, Object data) { StringBuffer sb = (StringBuffer) data; String functionName = node.getFunctionName(); if (functionName.equals(PropertyFunctionQueryNode.LOWER_CASE)) { sb.insert(0, "LOWER(").append(")"); } else if (functionName.equals(PropertyFunctionQueryNode.UPPER_CASE)) { sb.insert(0, "UPPER(").append(")"); } else { exceptions.add(new InvalidQueryException("Unsupported function: " + functionName)); } return sb; }
private Name checkSelectorName(String selectorName) throws RepositoryException { if (selectorName == null) { throw new InvalidQueryException("selectorName must not be null"); } try { return resolver.getQName(selectorName); } catch (NameException e) { throw new InvalidQueryException(e.getMessage()); } }
private Name checkSelectorName(String selectorName) throws RepositoryException { if (selectorName == null) { throw new InvalidQueryException("selectorName must not be null"); } try { return resolver.getQName(selectorName); } catch (NameException e) { throw new InvalidQueryException(e.getMessage()); } }
private Name checkPropertyName(String propertyName) throws RepositoryException { if (propertyName == null) { throw new InvalidQueryException("propertyName must not be null"); } try { return resolver.getQName(propertyName); } catch (NameException e) { throw new InvalidQueryException(e.getMessage()); } }
@Override public QueryImpl createQuery(String statement, String language) throws RepositoryException { if (!supportedQueryLanguages.contains(language)) { throw new InvalidQueryException("The specified language is not supported: " + language); } return new QueryImpl(this, statement, language, sessionContext); }
public Object visit(PropertyFunctionQueryNode node, Object data) { String functionName = node.getFunctionName(); if ((functionName.equals(PropertyFunctionQueryNode.LOWER_CASE) || functionName.equals(PropertyFunctionQueryNode.UPPER_CASE)) && rqn.getValueType() != QueryConstants.TYPE_STRING) { String msg = "Upper and lower case function are only supported with String literals"; exceptions.add(new InvalidQueryException(msg)); } return data; } }, null);
@Override public Query getQuery(Node node) throws RepositoryException { if (!node.isNodeType(JcrConstants.NT_QUERY)) { throw new InvalidQueryException("Not an nt:query node: " + node.getPath()); } String statement = node.getProperty(JcrConstants.JCR_STATEMENT).getString(); String language = node.getProperty(JcrConstants.JCR_LANGUAGE).getString(); QueryImpl query = createQuery(statement, language); query.setStoredQueryPath(node.getPath()); return query; }
protected void checkForProblems( Problems problems ) throws RepositoryException { if (problems.hasErrors()) { // Build a message with the problems ... StringBuilder msg = new StringBuilder(); for (Problem problem : problems) { if (problem.getStatus() != Status.ERROR) continue; msg.append(problem.getMessageString()).append("\n"); } throw new InvalidQueryException(msg.toString()); } } }
DescendantNodeImpl(NamePathResolver resolver, Name selectorName, Path path) throws InvalidQueryException, NamespaceException { super(resolver); this.selectorName = selectorName; this.path = path; if (!path.isAbsolute()) { throw new InvalidQueryException(resolver.getJCRPath(path) + " is not an absolute path"); } }
SameNodeImpl(NamePathResolver resolver, Name selectorName, Path path) throws InvalidQueryException, RepositoryException { super(resolver); this.selectorName = selectorName; this.path = path; if (!path.isAbsolute()) { throw new InvalidQueryException(resolver.getJCRPath(path) + " is not an absolute path"); } }
ChildNodeImpl(NamePathResolver resolver, Name selectorName, Path path) throws InvalidQueryException, RepositoryException { super(resolver); this.selectorName = selectorName; this.path = path; if (!path.isAbsolute()) { throw new InvalidQueryException(resolver.getJCRPath(path) + " is not an absolute path"); } }
/** * {@inheritDoc} */ public String toString(QueryObjectModel qom) throws InvalidQueryException { try { return QOMFormatter.format(qom); } catch (RepositoryException e) { throw new InvalidQueryException(e.getMessage(), e); } } }
/** * {@inheritDoc} */ public String toString(QueryObjectModel qom) throws InvalidQueryException { try { return QOMFormatter.format(qom); } catch (RepositoryException e) { throw new InvalidQueryException(e.getMessage(), e); } } }
SameNodeImpl(NamePathResolver resolver, Name selectorName, Path path) throws InvalidQueryException, RepositoryException { super(resolver); this.selectorName = selectorName; this.path = path; if (!path.isAbsolute()) { throw new InvalidQueryException(resolver.getJCRPath(path) + " is not an absolute path"); } }
public Object visit(LengthImpl node, Object data) throws Exception { Value staticValue = (Value) data; // make sure it can be converted to Long try { staticValue.getLong(); } catch (ValueFormatException e) { throw new InvalidQueryException("Static value " + staticValue.getString() + " cannot be converted to a Long"); } PropertyValueImpl propValue = (PropertyValueImpl) node.getPropertyValue(); return new LengthOperand((PropertyValueOperand) propValue.accept(this, null)); }