javax.jcr.query.InvalidQueryException Java Examples

The following examples show how to use javax.jcr.query.InvalidQueryException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProductsSuggestionOmniSearchHandler.java    From commerce-cif-connector with Apache License 2.0 5 votes vote down vote up
@Override
public QueryResult execute() throws InvalidQueryException, RepositoryException {
    // Get JCR results
    QueryResult queryResult = query.execute();

    // Get CIF products
    Iterator<Resource> it = getVirtualResults(resolver, Collections.singletonMap("fulltext", searchTerm), 10, 0);
    if (it == null || !it.hasNext()) {
        return queryResult; // No CIF results
    }

    ValueFactory valueFactory = resolver.adaptTo(Session.class).getValueFactory();
    List<Row> rows = new ArrayList<>();
    while (it.hasNext()) {
        String title = it.next().getValueMap().get(JcrConstants.JCR_TITLE, String.class);
        Value value = valueFactory.createValue(title);
        rows.add(new SuggestionRow(value));
    }

    RowIterator suggestionIterator = queryResult.getRows();
    while (suggestionIterator.hasNext()) {
        rows.add(suggestionIterator.nextRow());
    }

    SuggestionQueryResult result = new SuggestionQueryResult(rows);
    return result;
}
 
Example #2
Source File: QueryManagerImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
@Override
public Query createQuery(String statement, String language) throws InvalidQueryException, RepositoryException {
    for (Query query : queries)
        if (query.getLanguage().equals(language) && query.getStatement().equals(statement))
            return query;
    return new QueryImpl(statement, language, new QueryResultImpl());
}
 
Example #3
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Ordering descending(DynamicOperand operand) throws InvalidQueryException, RepositoryException {
    return delegate.descending(operand);
}
 
Example #4
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public NodeName nodeName(String selectorName) throws InvalidQueryException, RepositoryException {
    return delegate.nodeName(selectorName);
}
 
Example #5
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public NodeLocalName nodeLocalName(String selectorName) throws InvalidQueryException, RepositoryException {
    return delegate.nodeLocalName(selectorName);
}
 
Example #6
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public FullTextSearchScore fullTextSearchScore(String selectorName) throws InvalidQueryException, RepositoryException {
    return delegate.fullTextSearchScore(selectorName);
}
 
Example #7
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public LowerCase lowerCase(DynamicOperand operand) throws InvalidQueryException, RepositoryException {
    return delegate.lowerCase(operand);
}
 
Example #8
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public UpperCase upperCase(DynamicOperand operand) throws InvalidQueryException, RepositoryException {
    return delegate.upperCase(operand);
}
 
Example #9
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public BindVariableValue bindVariable(String bindVariableName) throws InvalidQueryException, RepositoryException {
    return delegate.bindVariable(bindVariableName);
}
 
Example #10
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Literal literal(Value literalValue) throws InvalidQueryException, RepositoryException {
    return delegate.literal(literalValue);
}
 
Example #11
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Ordering ascending(DynamicOperand operand) throws InvalidQueryException, RepositoryException {
    return delegate.ascending(operand);
}
 
Example #12
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public PropertyValue propertyValue(String selectorName, String propertyName) throws InvalidQueryException, RepositoryException {
    return delegate.propertyValue(selectorName, propertyName);
}
 
Example #13
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Column column(String selectorName, String propertyName, String columnName) throws InvalidQueryException, RepositoryException {
    return delegate.column(selectorName, propertyName, columnName);
}
 
Example #14
Source File: QueryManagerWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Query createQuery(String statement, String language) throws InvalidQueryException, RepositoryException {
    return sessionWrapper.getObjectWrapper().wrap(this.sessionWrapper, delegate.createQuery(statement, language));
}
 
Example #15
Source File: QueryManagerWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Query getQuery(Node node) throws InvalidQueryException, RepositoryException {
    return sessionWrapper.getObjectWrapper().wrap(sessionWrapper, delegate.getQuery(node));
}
 
Example #16
Source File: LazyLoadingQuery.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public QueryResult execute() throws InvalidQueryException, RepositoryException {
    contentLoader.prepareForQuery(lazyLoadingSession, this);
    return super.execute();
}
 
Example #17
Source File: QueryManagerImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Query getQuery(Node node) throws InvalidQueryException, RepositoryException {
    return null;
}
 
Example #18
Source File: QueryImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public QueryResult execute() throws InvalidQueryException, RepositoryException {
    return result;
}
 
Example #19
Source File: SessionFactoryUtils.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Jcr exception translator - it converts specific JSR-170 checked exceptions into unchecked Spring DA
 * exception.
 * @author Guillaume Bort <[email protected]>
 * @author Costin Leau
 * @author Sergio Bossa
 * @author Salvatore Incandela
 * @param ex
 * @return
 */
public static DataAccessException translateException(RepositoryException ex) {
    if (ex instanceof AccessDeniedException) {
        return new DataRetrievalFailureException("Access denied to this data", ex);
    }
    if (ex instanceof ConstraintViolationException) {
        return new DataIntegrityViolationException("Constraint has been violated", ex);
    }
    if (ex instanceof InvalidItemStateException) {
        return new ConcurrencyFailureException("Invalid item state", ex);
    }
    if (ex instanceof InvalidQueryException) {
        return new DataRetrievalFailureException("Invalid query", ex);
    }
    if (ex instanceof InvalidSerializedDataException) {
        return new DataRetrievalFailureException("Invalid serialized data", ex);
    }
    if (ex instanceof ItemExistsException) {
        return new DataIntegrityViolationException("An item already exists", ex);
    }
    if (ex instanceof ItemNotFoundException) {
        return new DataRetrievalFailureException("Item not found", ex);
    }
    if (ex instanceof LoginException) {
        return new DataAccessResourceFailureException("Bad login", ex);
    }
    if (ex instanceof LockException) {
        return new ConcurrencyFailureException("Item is locked", ex);
    }
    if (ex instanceof MergeException) {
        return new DataIntegrityViolationException("Merge failed", ex);
    }
    if (ex instanceof NamespaceException) {
        return new InvalidDataAccessApiUsageException("Namespace not registred", ex);
    }
    if (ex instanceof NoSuchNodeTypeException) {
        return new InvalidDataAccessApiUsageException("No such node type", ex);
    }
    if (ex instanceof NoSuchWorkspaceException) {
        return new DataAccessResourceFailureException("Workspace not found", ex);
    }
    if (ex instanceof PathNotFoundException) {
        return new DataRetrievalFailureException("Path not found", ex);
    }
    if (ex instanceof ReferentialIntegrityException) {
        return new DataIntegrityViolationException("Referential integrity violated", ex);
    }
    if (ex instanceof UnsupportedRepositoryOperationException) {
        return new InvalidDataAccessApiUsageException("Unsupported operation", ex);
    }
    if (ex instanceof ValueFormatException) {
        return new InvalidDataAccessApiUsageException("Incorrect value format", ex);
    }
    if (ex instanceof VersionException) {
        return new DataIntegrityViolationException("Invalid version graph operation", ex);
    }
    // fallback
    return new JcrSystemException(ex);
}
 
Example #20
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public And and(Constraint constraint1, Constraint constraint2) throws InvalidQueryException, RepositoryException {
    return delegate.and(constraint1, constraint2);
}
 
Example #21
Source File: QueryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public QueryResult execute() throws InvalidQueryException, RepositoryException {
    return sessionWrapper.getObjectWrapper().wrap(sessionWrapper, delegate.execute());
}
 
Example #22
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public QueryObjectModel createQuery(Source source, Constraint constraint, Ordering[] orderings, Column[] columns) throws InvalidQueryException, RepositoryException {
    return new QueryObjectModelWrapper(this.sessionWrapper, delegate.createQuery(source, constraint, orderings, columns));
}
 
Example #23
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Selector selector(String nodeTypeName, String selectorName) throws InvalidQueryException, RepositoryException {
    return delegate.selector(nodeTypeName, selectorName);
}
 
Example #24
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Join join(Source left, Source right, String joinType, JoinCondition joinCondition) throws InvalidQueryException, RepositoryException {
    return delegate.join(left, right, joinType, joinCondition);
}
 
Example #25
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public EquiJoinCondition equiJoinCondition(String selector1Name, String property1Name, String selector2Name, String property2Name) throws InvalidQueryException, RepositoryException {
    return delegate.equiJoinCondition(selector1Name, property1Name, selector2Name, property2Name);
}
 
Example #26
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public SameNodeJoinCondition sameNodeJoinCondition(String selector1Name, String selector2Name, String selector2Path) throws InvalidQueryException, RepositoryException {
    return delegate.sameNodeJoinCondition(selector1Name, selector2Name, selector2Path);
}
 
Example #27
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public ChildNodeJoinCondition childNodeJoinCondition(String childSelectorName, String parentSelectorName) throws InvalidQueryException, RepositoryException {
    return delegate.childNodeJoinCondition(childSelectorName, parentSelectorName);
}
 
Example #28
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public DescendantNodeJoinCondition descendantNodeJoinCondition(String descendantSelectorName, String ancestorSelectorName) throws InvalidQueryException, RepositoryException {
    return delegate.descendantNodeJoinCondition(descendantSelectorName, ancestorSelectorName);
}
 
Example #29
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Length length(PropertyValue propertyValue) throws InvalidQueryException, RepositoryException {
    return delegate.length(propertyValue);
}
 
Example #30
Source File: QueryObjectModelFactoryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Or or(Constraint constraint1, Constraint constraint2) throws InvalidQueryException, RepositoryException {
    return delegate.or(constraint1, constraint2);
}