private void updateViewGroupsWithoutFilters(final View view, final Function<ViewElementDefinition, Boolean> hasFilters) { groupsWithoutFilters = new HashSet<>(); for (final Map.Entry<String, ViewElementDefinition> entry : new ChainedIterable<Map.Entry<String, ViewElementDefinition>>(view.getEntities().entrySet(), view.getEdges().entrySet())) { if (null == entry.getValue() || !hasFilters.apply(entry.getValue())) { groupsWithoutFilters.add(entry.getKey()); } } LOGGER.debug("The following groups will not be filtered: {}", StringUtils.join(groupsWithoutFilters, ',')); }
@Override public Iterator<E> iterator() { if (backingMap.isEmpty()) { return Iterators.emptyIterator(); } final Iterable[] values = Iterables.toArray(backingMap.values(), Iterable.class); if (0 == values.length) { return Iterators.emptyIterator(); } return new ChainedIterable<E>(values).iterator(); }
private void updateSchemaGroupsWithoutFilters() { groupsWithoutFilters = new HashSet<>(); for (final Map.Entry<String, SchemaElementDefinition> entry : new ChainedIterable<Map.Entry<String, SchemaElementDefinition>>(schema.getEntities().entrySet(), schema.getEdges().entrySet())) { if (null == entry.getValue() || !entry.getValue().hasValidation()) { groupsWithoutFilters.add(entry.getKey()); } } LOGGER.debug("The following groups will not be filtered: {}", StringUtils.join(groupsWithoutFilters, ',')); } }
private Set<String> getGroupsWithTransforms(final View view) { final Set<String> groups = new HashSet<>(); for (final Map.Entry<String, ViewElementDefinition> entry : new ChainedIterable<Map.Entry<String, ViewElementDefinition>>(view.getEntities().entrySet(), view.getEdges().entrySet())) { if (null != entry.getValue()) { if (entry.getValue().hasPostTransformFilters()) { groups.add(entry.getKey()); } } } return groups; } }
@Override protected O mergeResults(final List<O> results, final OP operation, final Context context, final Store store) { if (results.isEmpty()) { return (O) new EmptyClosableIterable<>(); } // Concatenate all the results into 1 iterable return (O) new ChainedIterable<>(CollectionUtil.toIterableArray(results)); } }
@Override public Iterable<Element> _apply(final String line) { final List<Edge> edges = createEdges(line); final List<Entity> cardinalities = createCardinalities(edges); // Create an iterable containing all the edges and cardinality entities return new ChainedIterable<>(edges, cardinalities); }
protected CloseableIterable<O_ITEM> mergeResults(final List<Object> results, final FederatedOperationChain<I, O_ITEM> operation, final Context context, final Store store) { if (Void.class.equals(operation.getOperationChain().getOutputClass())) { return null; } if (results.isEmpty()) { return null; } if (1 == results.size() && results.get(0) instanceof Iterable) { return new WrappedCloseableIterable(((Iterable) results.get(0))); } boolean areIterable = true; for (final Object result : results) { if (!(result instanceof Iterable)) { areIterable = false; break; } } if (areIterable) { return new ChainedIterable(CollectionUtil.toIterableArray((List) results)); } return new WrappedCloseableIterable(results); } }
@Override protected void validateSchema(final ValidationResult validationResult, final Serialiser serialiser) { super.validateSchema(validationResult, serialiser); final String timestampProperty = getSchema().getConfig(AccumuloStoreConstants.TIMESTAMP_PROPERTY); if (null != timestampProperty) { final Iterable<SchemaElementDefinition> defs = new ChainedIterable<>(getSchema().getEntities().values(), getSchema().getEdges().values()); for (final SchemaElementDefinition def : defs) { final TypeDefinition typeDef = def.getPropertyTypeDef(timestampProperty); if (null != typeDef && null != typeDef.getAggregateFunction() && !(typeDef.getAggregateFunction() instanceof Max)) { validationResult.addError("The aggregator for the " + timestampProperty + " property must be set to: " + Max.class.getName() + " this cannot be overridden for this Accumulo Store, as you have told Accumulo to store this property in the timestamp column."); } } } }
return new ChainedIterable<>(edges, entities, cardinalityEntities);
return new ChainedIterable<>(edges, entities, cardinalityEntities);