/** * @return a textual description of what components, if any, are blocking access */ public String describeWhoIsBlocking() { if ( blockingRequirements.size() > 0 || requirementCount.get() > 0 ) { String causes = Iterables.join( ", ", Iterables.map( AvailabilityRequirement::description, blockingRequirements ) ); return requirementCount.get() + " reasons for blocking: " + causes + "."; } return "No blocking components"; }
public static <FROM, TO> Iterable<TO> flatMap( Function<? super FROM, ? extends Iterable<TO>> function, Iterable<FROM> from ) { return new CombiningIterable<>( map(function, from) ); }
private Iterable<String> asNames( Iterable<Label> nodeLabels ) { return map( Label::name, nodeLabels ); }
public Representation getLabelUniquenessConstraints( String labelName ) { return new ListRepresentation( CONSTRAINT_DEFINITION, map( CONSTRAINT_DEF_TO_REPRESENTATION, filteredNodeConstraints( labelName, ConstraintType.UNIQUENESS ) ) ); }
public Representation getRelationshipTypeExistenceConstraints( String typeName ) { return new ListRepresentation( CONSTRAINT_DEFINITION, map( CONSTRAINT_DEF_TO_REPRESENTATION, filteredRelationshipConstraints( typeName, ConstraintType.RELATIONSHIP_PROPERTY_EXISTENCE ) ) ); } }
/** * Gets all {@link RecordFormats} that the selector is aware of. * @return An iterable over all known record formats. */ public static Iterable<RecordFormats> allFormats() { Iterable<RecordFormats.Factory> loadableFormatFactories = Service.load( RecordFormats.Factory.class ); Iterable<RecordFormats> loadableFormats = map( RecordFormats.Factory::newInstance, loadableFormatFactories ); return concat( KNOWN_FORMATS, loadableFormats ); }
public Representation getLabelExistenceConstraints( String labelName ) { return new ListRepresentation( CONSTRAINT_DEFINITION, map( CONSTRAINT_DEF_TO_REPRESENTATION, filteredNodeConstraints( labelName, ConstraintType.NODE_PROPERTY_EXISTENCE ) ) ); }
private void stopModules() { new RunCarefully( map( module -> module::stop, serverModules ) ).run(); }
protected void serialize( ConstraintDefinition constraintDefinition, MappingSerializer serializer ) { Function<String, Representation> converter = ValueRepresentation::string; Iterable<Representation> propertyKeyRepresentations = map( converter, constraintDefinition.getPropertyKeys() ); serializer.putList( "property_keys", new ListRepresentation( RepresentationType.STRING, propertyKeyRepresentations ) ); } }
public Representation getAllPropertyKeys() { Collection<ValueRepresentation> propKeys = Iterables.asSet( map( ValueRepresentation::string, graphDb.getAllPropertyKeys() ) ); return new ListRepresentation( RepresentationType.STRING, propKeys ); }
public ListRepresentation getConstraints() { return new ListRepresentation( CONSTRAINT_DEFINITION, map( CONSTRAINT_DEF_TO_REPRESENTATION, graphDb.schema().getConstraints() ) ); }
private static <T extends CloneableInPublic> Iterable<T> cloned( Iterable<T> items, final Class<T> itemClass ) { return Iterables.map( from -> itemClass.cast( from.clone() ), items ); } }
public ListRepresentation getLabelConstraints( String labelName ) { return new ListRepresentation( CONSTRAINT_DEFINITION, map( CONSTRAINT_DEF_TO_REPRESENTATION, filteredNodeConstraints( labelName, Predicates.alwaysTrue() ) ) ); }
@Override public Iterable<IndexDescriptor> constraintIndexesCreatedInTx() { if ( createdConstraintIndexesByConstraint != null && !createdConstraintIndexesByConstraint.isEmpty() ) { return map( TxState::getIndexForIndexBackedConstraint, createdConstraintIndexesByConstraint.keySet() ); } return Iterables.empty(); }
public static Set<String> asLabelNameSet( Iterable<Label> enums ) { return Iterables.asSet( map( Label::name, enums ) ); }
public ListRepresentation getAllLabels( boolean inUse ) { ResourceIterable<Label> labels = inUse ? graphDb.getAllLabelsInUse() : graphDb.getAllLabels(); Collection<ValueRepresentation> labelNames = Iterables.asSet( map( label -> ValueRepresentation.string( label.name() ), labels ) ); return new ListRepresentation( RepresentationType.STRING, labelNames ); }
private List<IndexEntryUpdate<IndexDescriptor>> forUpdates( IndexDescriptor index, EntityUpdates... updates ) { return Iterables.asList( Iterables.concat( Iterables.map( update -> update.forIndexKeys( Iterables.asIterable( index ) ), Arrays.asList( updates ) ) ) ); }
public ListRepresentation getSchemaIndexes() { Iterable<IndexDefinition> definitions = graphDb.schema().getIndexes(); Iterable<IndexDefinitionRepresentation> representations = map( definition -> new IndexDefinitionRepresentation( definition, graphDb.schema().getIndexState( definition ), graphDb.schema().getIndexPopulationProgress( definition ) ), definitions ); return new ListRepresentation( RepresentationType.INDEX_DEFINITION, representations ); }
public ListRepresentation getSchemaIndexes( String labelName ) { Iterable<IndexDefinition> definitions = graphDb.schema().getIndexes( label( labelName ) ); Iterable<IndexDefinitionRepresentation> representations = map( definition -> new IndexDefinitionRepresentation( definition, graphDb.schema().getIndexState( definition ), graphDb.schema().getIndexPopulationProgress( definition ) ), definitions ); return new ListRepresentation( RepresentationType.INDEX_DEFINITION, representations ); }
@Test public void shouldListAllExistingLabels() { // Given GraphDatabaseService db = dbRule.getGraphDatabaseAPI(); createNode( db, Labels.MY_LABEL, Labels.MY_OTHER_LABEL ); List<Label> labels = null; // When try ( Transaction tx = db.beginTx() ) { labels = asList( db.getAllLabels() ); } // Then assertEquals( 2, labels.size() ); assertThat( map( Label::name, labels ), hasItems( Labels.MY_LABEL.name(), Labels.MY_OTHER_LABEL.name() ) ); }