throw new QueryExecutionException("Failed to merge tree. " + fieldNameAppender + " type: " + update.getNodeType() + " (expected: " + (isRoot ? OBJECT : base.getNodeType()) + ')');
/** * Performs the specified {@link Query}. * * @return the {@link Entry} on a successful query. * The specified {@code other} on a failure due to missing entry. * * @see #get(Revision, Query) */ default <T> CompletableFuture<Entry<T>> getOrNull(Revision revision, Query<T> query) { requireNonNull(query, "query"); requireNonNull(revision, "revision"); return getOrNull(revision, query.path()).thenApply(result -> { if (result == null) { return null; } @SuppressWarnings("unchecked") final Entry<T> entry = (Entry<T>) result; try { return applyQuery(entry, query); } catch (CentralDogmaException e) { throw e; } catch (Exception e) { throw new QueryExecutionException(e); } }); }
/** * Performs the specified {@link Query}. * * @return the {@link Entry} on a successful query. * The specified {@code other} on a failure due to missing entry. * * @see #get(Revision, Query) */ default <T> CompletableFuture<Entry<T>> getOrNull(Revision revision, Query<T> query) { requireNonNull(query, "query"); requireNonNull(revision, "revision"); return getOrNull(revision, query.path()).thenApply(result -> { if (result == null) { return null; } @SuppressWarnings("unchecked") final Entry<T> entry = (Entry<T>) result; try { return applyQuery(entry, query); } catch (CentralDogmaException e) { throw e; } catch (Exception e) { throw new QueryExecutionException(e); } }); }
throw new QueryExecutionException("Failed to merge tree. " + fieldNameAppender + " type: " + update.getNodeType() + " (expected: " + (isRoot ? OBJECT : base.getNodeType()) + ')');
public static JsonNode extractTree(JsonNode jsonNode, String jsonPath) { requireNonNull(jsonNode, "jsonNode"); requireNonNull(jsonPath, "jsonPath"); final JsonPath compiledJsonPath; try { compiledJsonPath = JsonPath.compile(jsonPath); } catch (Exception e) { throw new QuerySyntaxException("invalid JSON path: " + jsonPath, e); } try { return JsonPath.parse(jsonNode, jsonPathCfg) .read(compiledJsonPath, JsonNode.class); } catch (Exception e) { throw new QueryExecutionException("JSON path evaluation failed: " + jsonPath, e); } }
public static JsonNode extractTree(JsonNode jsonNode, String jsonPath) { requireNonNull(jsonNode, "jsonNode"); requireNonNull(jsonPath, "jsonPath"); final JsonPath compiledJsonPath; try { compiledJsonPath = JsonPath.compile(jsonPath); } catch (Exception e) { throw new QuerySyntaxException("invalid JSON path: " + jsonPath, e); } try { return JsonPath.parse(jsonNode, jsonPathCfg) .read(compiledJsonPath, JsonNode.class); } catch (Exception e) { throw new QueryExecutionException("JSON path evaluation failed: " + jsonPath, e); } }
public static JsonNode extractTree(JsonNode jsonNode, String jsonPath) { requireNonNull(jsonNode, "jsonNode"); requireNonNull(jsonPath, "jsonPath"); final JsonPath compiledJsonPath; try { compiledJsonPath = JsonPath.compile(jsonPath); } catch (Exception e) { throw new QuerySyntaxException("invalid JSON path: " + jsonPath, e); } try { return JsonPath.parse(jsonNode, jsonPathCfg) .read(compiledJsonPath, JsonNode.class); } catch (Exception e) { throw new QueryExecutionException("JSON path evaluation failed: " + jsonPath, e); } }
if (cause != null) { if (!(cause instanceof CentralDogmaException)) { cause = new QueryExecutionException(cause);
if (cause != null) { if (!(cause instanceof CentralDogmaException)) { cause = new QueryExecutionException(cause);
/** * Applies the specified {@link Query} to the {@link Entry#content()} of the specified {@link Entry} and * returns the query result. * * @throws IllegalStateException if the specified {@link Entry} is a directory * @throws QuerySyntaxException if the syntax of specified {@link Query} is invalid * @throws QueryExecutionException if an {@link Exception} is raised while applying the specified * {@link Query} to the {@link Entry#content()} */ static <T> Entry<T> applyQuery(Entry<T> entry, Query<T> query) { requireNonNull(query, "query"); entry.content(); // Ensure that content is not null. final EntryType entryType = entry.type(); final QueryType queryType = query.type(); if (!queryType.supportedEntryTypes().contains(entryType)) { throw new QueryExecutionException("Unsupported entry type: " + entryType + " (query: " + query + ')'); } if (queryType == IDENTITY) { return entry; } else if (queryType == JSON_PATH) { return Entry.of(entry.revision(), query.path(), entryType, query.apply(entry.content())); } else { throw new QueryExecutionException("Unsupported entry type: " + entryType + " (query: " + query + ')'); } }
/** * Performs the specified {@link Query}. * * @return the {@link Entry} on a successful query. * The specified {@code other} on a failure due to missing entry. * * @see #get(Revision, Query) */ default <T> CompletableFuture<Entry<T>> getOrNull(Revision revision, Query<T> query) { requireNonNull(query, "query"); requireNonNull(revision, "revision"); return getOrNull(revision, query.path()).thenApply(entry -> { if (entry == null) { return null; } final EntryType entryType = entry.type(); if (!query.type().supportedEntryTypes().contains(entryType)) { throw new QueryExecutionException("unsupported entry type: " + entryType); } @SuppressWarnings("unchecked") final T entryContent = (T) entry.content(); try { return Entry.of(entry.revision(), query.path(), entryType, query.apply(entryContent)); } catch (CentralDogmaException e) { throw e; } catch (Exception e) { throw new QueryExecutionException(e); } }); }
/** * Applies the specified {@link Query} to the {@link Entry#content()} of the specified {@link Entry} and * returns the query result. * * @throws IllegalStateException if the specified {@link Entry} is a directory * @throws QuerySyntaxException if the syntax of specified {@link Query} is invalid * @throws QueryExecutionException if an {@link Exception} is raised while applying the specified * {@link Query} to the {@link Entry#content()} */ static <T> Entry<T> applyQuery(Entry<T> entry, Query<T> query) { requireNonNull(query, "query"); entry.content(); // Ensure that content is not null. final EntryType entryType = entry.type(); final QueryType queryType = query.type(); if (!queryType.supportedEntryTypes().contains(entryType)) { throw new QueryExecutionException("Unsupported entry type: " + entryType + " (query: " + query + ')'); } if (queryType == IDENTITY) { return entry; } else if (queryType == JSON_PATH) { return Entry.of(entry.revision(), query.path(), entryType, query.apply(entry.content())); } else { throw new QueryExecutionException("Unsupported entry type: " + entryType + " (query: " + query + ')'); } }
throw new QueryExecutionException("unsupported entry type: " + toEntryType); throw new QueryExecutionException("unsupported entry type: " + entryType); throw new QueryExecutionException( "mismatching entry type: " + entryType + " != " + toEntry.type());
throw new QueryExecutionException("unsupported entry type: " + toEntryType); throw new QueryExecutionException("unsupported entry type: " + entryType); throw new QueryExecutionException( "mismatching entry type: " + entryType + " != " + toEntry.type());
throw new QueryExecutionException("unsupported entry type: " + toEntryType); throw new QueryExecutionException("unsupported entry type: " + entryType); throw new QueryExecutionException( "mismatching entry type: " + entryType + " != " + toEntry.type());
break; case QUERY_FAILURE: convertedCause = new QueryExecutionException(message, false); break; case SHUTTING_DOWN:
break; case QUERY_FAILURE: convertedCause = new QueryExecutionException(message, false); break; case SHUTTING_DOWN:
break; case QUERY_FAILURE: convertedCause = new QueryExecutionException(message, false); break; case SHUTTING_DOWN: