/** * Create an exception wrapping the given checked JCR exception * * @param cause The wrapped JCR <code>InvalidQueryException</code> */ public InvalidQueryException(javax.jcr.query.InvalidQueryException cause) { super(cause.getMessage(), cause); } }
/** * Create an exception wrapping the given checked JCR exception * * @param cause The wrapped JCR <code>InvalidQueryException</code> */ public InvalidQueryException(javax.jcr.query.InvalidQueryException cause) { super(cause.getMessage(), cause); } }
private static void extractPrototype(final JcrMatcher matcher, final Map<String, Set<String>> types, final QueryManager qmgr, final Node queryTemplate) throws RepositoryException { try { Set<String> prototypes = new TreeSet<>(); if (queryTemplate.isNodeType("nt:query")) { Query query = qmgr.getQuery(queryTemplate); query = qmgr.createQuery(queryTemplate.getProperty("jcr:statement").getString(), query.getLanguage()); // HREPTWO-1266 QueryResult rs = query.execute(); for (NodeIterator iter = rs.getNodes(); iter.hasNext(); ) { Node typeNode = iter.nextNode(); if (typeNode.getName().equals(EssentialConst.HIPPOSYSEDIT_PROTOTYPE)) { String documentType = typeNode.getPrimaryNodeType().getName(); final boolean isTemplate = INTERNAL_TYPES_PREDICATE.apply(documentType); if (isTemplate && (matcher == null || matcher.matches(typeNode))) { prototypes.add(documentType); } } else { prototypes.add(typeNode.getName()); } } } types.put(queryTemplate.getName(), prototypes); } catch (InvalidQueryException ex) { log.error(MessageFormat.format("{0}: {1}", ex.getClass().getName(), ex.getMessage()), ex); } }
private static void extractPrototype(final JcrMatcher matcher, final Map<String, Set<String>> types, final QueryManager qmgr, final Node queryTemplate) throws RepositoryException { try { Set<String> prototypes = new TreeSet<>(); if (queryTemplate.isNodeType("nt:query")) { Query query = qmgr.getQuery(queryTemplate); query = qmgr.createQuery(queryTemplate.getProperty("jcr:statement").getString(), query.getLanguage()); // HREPTWO-1266 QueryResult rs = query.execute(); for (NodeIterator iter = rs.getNodes(); iter.hasNext(); ) { Node typeNode = iter.nextNode(); if (typeNode.getName().equals(EssentialConst.HIPPOSYSEDIT_PROTOTYPE)) { String documentType = typeNode.getPrimaryNodeType().getName(); final boolean isTemplate = INTERNAL_TYPES_PREDICATE.apply(documentType); if (isTemplate && (matcher == null || matcher.matches(typeNode))) { prototypes.add(documentType); } } else { prototypes.add(typeNode.getName()); } } } types.put(queryTemplate.getName(), prototypes); } catch (InvalidQueryException ex) { log.error(MessageFormat.format("{0}: {1}", ex.getClass().getName(), ex.getMessage()), ex); } }
log.error(ex.getClass().getName()+": "+ex.getMessage(), ex);
return new HstQueryResultImpl(this.objectConverter, queryResult, this.hstCtxWhereClauseComputer.getVirtualizer(scopes, this.skipInvalidScopes)); } catch (InvalidQueryException e) { throw new QueryException(e.getMessage(), e); } catch (LoginException e) { log.warn("LoginException. Return null : {}", e);
response.sendError(400, e.getMessage()); e.printStackTrace(response.getWriter()); } catch (final Exception e) {
@Override public HstQueryResult execute() throws QueryException { try { String query = getQuery(); QueryManager jcrQueryManager = getQueryManager(); Query jcrQuery = jcrQueryManager.createQuery(query, "xpath"); if (offset > -1){ jcrQuery.setOffset(offset); } if (limit > -1){ jcrQuery.setLimit(limit); } QueryResult queryResult = jcrQuery.execute(); return new HstQueryResultImpl(objectConverter, queryResult); } catch (InvalidQueryException e) { throw new QueryException(e.getMessage(), e); } catch (LoginException e) { log.warn("LoginException. Return null : {}", e); } catch (RepositoryException e) { throw new QueryException(e.getMessage(), e); } return null; }
throw new QuerySyntaxException(iqe.getMessage(), query, language, iqe); } catch (final RepositoryException re) {
@Override public Iterator<Resource> findResources(final ResolveContext<JcrProviderState> ctx, final String query, final String language) { try { final QueryResult res = JcrResourceUtil.query(ctx.getProviderState().getSession(), query, language); return new JcrNodeResourceIterator(ctx.getResourceResolver(), null, null, res.getNodes(), ctx.getProviderState().getHelperData(), this.providerContext.getExcludedPaths()); } catch (final javax.jcr.query.InvalidQueryException iqe) { throw new QuerySyntaxException(iqe.getMessage(), query, language, iqe); } catch (final RepositoryException re) { throw new SlingException(re.getMessage(), re); } }