Skip to content

Commit

Permalink
Remove deprecated findNodesByLabelAndProperty from GraphDatabaseService
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed Mar 16, 2016
1 parent 737a1fb commit 4346574
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 64 deletions.
Expand Up @@ -146,33 +146,6 @@ public interface GraphDatabaseService
*/ */
ResourceIterator<Node> findNodes( Label label ); ResourceIterator<Node> findNodes( Label label );


/**
* Returns all nodes having the label, and the wanted property value.
* If an online index is found, it will be used to look up the requested
* nodes.
* <p>
* If no indexes exist for the label/property combination, the database will
* scan all labeled nodes looking for the property value.
* <p>
* Note that equality for values do not follow the rules of Java. This means that the number 42 is equals to all
* other 42 numbers, indifferently of if they are encoded as Integer, Long, Float, Short, Byte or Double.
* <p>
* Same rules follow Character and String - the Character 'A' is equal to the String 'A'.
* <p>
* Finally - arrays also follow these rules. An int[] {1,2,3} is equal to a double[] {1.0, 2.0, 3.0}
* <p>
* Please ensure that the returned {@link ResourceIterable} is closed correctly and as soon as possible
* inside your transaction to avoid potential blocking of write operations.
*
* @param label consider nodes with this label
* @param key required property key
* @param value required property value
* @return an iterable containing all matching nodes. See {@link ResourceIterable} for responsibilities.
* @deprecated Use {@link #findNodes(Label, String, Object)}
*/
@Deprecated
ResourceIterable<Node> findNodesByLabelAndProperty( Label label, String key, Object value );

/** /**
* Returns all relationship types currently in the underlying store. * Returns all relationship types currently in the underlying store.
* Relationship types are added to the underlying store the first time they * Relationship types are added to the underlying store the first time they
Expand Down
Expand Up @@ -501,13 +501,6 @@ public ResourceIterator<Node> findNodes( final Label myLabel )
return allNodesWithLabel( myLabel ); return allNodesWithLabel( myLabel );
} }


@Override
public ResourceIterable<Node> findNodesByLabelAndProperty( final Label myLabel, final String key,
final Object value )
{
return () -> nodesByLabelAndProperty( myLabel, key, value );
}

private ResourceIterator<Node> nodesByLabelAndProperty( Label myLabel, String key, Object value ) private ResourceIterator<Node> nodesByLabelAndProperty( Label myLabel, String key, Object value )
{ {
Statement statement = spi.currentStatement(); Statement statement = spi.currentStatement();
Expand Down
Expand Up @@ -82,20 +82,6 @@ public void call( GraphDatabaseService graphDatabaseService )
} }
}; };


static final FacadeMethod<GraphDatabaseService> FIND_NODES_BY_LABEL_AND_PROPERTY =
new FacadeMethod<GraphDatabaseService>(
"ResourceIterator<Node> findNodes( Label label, String key, Object value )" )
{
@Override
public void call( GraphDatabaseService graphDatabaseService )
{
for ( Node node : graphDatabaseService.findNodesByLabelAndProperty( label( "bar" ), "baz", 23 ) )
{

}
}
};

static final FacadeMethod<GraphDatabaseService> FIND_NODES_BY_LABEL_AND_PROPERTY_DEPRECATED = static final FacadeMethod<GraphDatabaseService> FIND_NODES_BY_LABEL_AND_PROPERTY_DEPRECATED =
new FacadeMethod<GraphDatabaseService>( new FacadeMethod<GraphDatabaseService>(
"ResourceIterator<Node> findNodeByLabelAndProperty( Label label, String key, Object value )" ) "ResourceIterator<Node> findNodeByLabelAndProperty( Label label, String key, Object value )" )
Expand Down Expand Up @@ -171,7 +157,6 @@ public void call( GraphDatabaseService graphDatabaseService )
GET_NODE_BY_ID, GET_NODE_BY_ID,
GET_RELATIONSHIP_BY_ID, GET_RELATIONSHIP_BY_ID,
GET_ALL_NODES, GET_ALL_NODES,
FIND_NODES_BY_LABEL_AND_PROPERTY,
FIND_NODES_BY_LABEL_AND_PROPERTY_DEPRECATED, FIND_NODES_BY_LABEL_AND_PROPERTY_DEPRECATED,
FIND_NODES_BY_LABEL, FIND_NODES_BY_LABEL,
GET_ALL_RELATIONSHIP_TYPES, GET_ALL_RELATIONSHIP_TYPES,
Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.neo4j.collection.primitive.PrimitiveLongIterator; import org.neo4j.collection.primitive.PrimitiveLongIterator;
import org.neo4j.collection.primitive.PrimitiveLongSet; import org.neo4j.collection.primitive.PrimitiveLongSet;
import org.neo4j.graphdb.schema.IndexDefinition; import org.neo4j.graphdb.schema.IndexDefinition;
import org.neo4j.helpers.collection.Iterables; import org.neo4j.helpers.collection.Iterators;
import org.neo4j.kernel.api.ReadOperations; import org.neo4j.kernel.api.ReadOperations;
import org.neo4j.kernel.api.Statement; import org.neo4j.kernel.api.Statement;
import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException; import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException;
Expand Down Expand Up @@ -475,8 +475,8 @@ public void shouldAddIndexedPropertyToNodeWithDynamicLabels()
String key = propertyKeyPrefix + i; String key = propertyKeyPrefix + i;
String value = propertyValuePrefix + i; String value = propertyValuePrefix + i;


ResourceIterable<Node> nodes = db.findNodesByLabelAndProperty( label, key, value ); ResourceIterator<Node> nodes = db.findNodes( label, key, value );
assertEquals( 1, Iterables.count( nodes ) ); assertEquals( 1, Iterators.count( nodes ) );
} }
tx.success(); tx.success();
} }
Expand Down
Expand Up @@ -420,12 +420,6 @@ public ResourceIterator<Node> findNodes( Label label )
return database.findNodes( label ); return database.findNodes( label );
} }


@Override
public ResourceIterable<Node> findNodesByLabelAndProperty( Label label, String key, Object value )
{
return database.findNodesByLabelAndProperty( label, key, value );
}

@Override @Override
public ResourceIterable<RelationshipType> getAllRelationshipTypes() public ResourceIterable<RelationshipType> getAllRelationshipTypes()
{ {
Expand Down
Expand Up @@ -1063,10 +1063,4 @@ public ResourceIterator<Node> findNodes( Label label )
{ {
return actual.findNodes( label ); return actual.findNodes( label );
} }

@Override
public ResourceIterable<Node> findNodesByLabelAndProperty( Label label, String key, Object value )
{
return actual.findNodesByLabelAndProperty( label, key, value );
}
} }

0 comments on commit 4346574

Please sign in to comment.