@Override public Iterable<String> getPropertyKeys() { KernelTransaction transaction = spi.kernelTransaction(); List<String> keys = new ArrayList<>(); try { RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor properties = transaction.ambientPropertyCursor(); singleRelationship( transaction, relationships ); TokenRead token = transaction.tokenRead(); relationships.properties( properties ); while ( properties.next() ) { keys.add( token.propertyKeyName( properties.propertyKey() )); } } catch ( PropertyKeyIdNotFoundKernelException e ) { throw new IllegalStateException( "Property key retrieved through kernel API should exist.", e ); } return keys; }
RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor propertyCursor = transaction.ambientPropertyCursor(); singleRelationship( transaction, relationships ); relationships.properties( propertyCursor ); int propertiesToFind = itemsToReturn;
@Override public Map<String, Object> getAllProperties() { KernelTransaction transaction = spi.kernelTransaction(); Map<String,Object> properties = new HashMap<>(); try { RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor propertyCursor = transaction.ambientPropertyCursor(); TokenRead token = transaction.tokenRead(); singleRelationship( transaction, relationships ); relationships.properties( propertyCursor ); while ( propertyCursor.next() ) { properties.put( token.propertyKeyName( propertyCursor.propertyKey() ), propertyCursor.propertyValue().asObjectCopy() ); } } catch ( PropertyKeyIdNotFoundKernelException e ) { throw new IllegalStateException( "Property key retrieved through kernel API should exist.", e ); } return properties; }
singleRelationship( transaction, relationships ); relationships.properties( properties ); while ( properties.next() )
@Override public Object getProperty( String key, Object defaultValue ) { if ( null == key ) { throw new IllegalArgumentException( "(null) property key is not allowed" ); } KernelTransaction transaction = spi.kernelTransaction(); RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor properties = transaction.ambientPropertyCursor(); int propertyKey = transaction.tokenRead().propertyKey( key ); if ( propertyKey == TokenRead.NO_TOKEN ) { return defaultValue; } singleRelationship( transaction, relationships ); relationships.properties( properties ); while ( properties.next() ) { if ( propertyKey == properties.propertyKey() ) { Value value = properties.propertyValue(); return value == Values.NO_VALUE ? defaultValue : value.asObjectCopy(); } } return defaultValue; }
@Override public boolean hasProperty( String key ) { if ( null == key ) { return false; } KernelTransaction transaction = spi.kernelTransaction(); int propertyKey = transaction.tokenRead().propertyKey( key ); if ( propertyKey == TokenRead.NO_TOKEN ) { return false; } RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor properties = transaction.ambientPropertyCursor(); singleRelationship( transaction, relationships ); relationships.properties( properties ); while ( properties.next() ) { if ( propertyKey == properties.propertyKey() ) { return true; } } return false; }
@Override public Iterable<String> getPropertyKeys() { KernelTransaction transaction = spi.kernelTransaction(); List<String> keys = new ArrayList<>(); try { RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor properties = transaction.ambientPropertyCursor(); singleRelationship( transaction, relationships ); TokenRead token = transaction.tokenRead(); relationships.properties( properties ); while ( properties.next() ) { keys.add( token.propertyKeyName( properties.propertyKey() )); } } catch ( PropertyKeyIdNotFoundKernelException e ) { throw new IllegalStateException( "Property key retrieved through kernel API should exist.", e ); } return keys; }
RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor propertyCursor = transaction.ambientPropertyCursor(); singleRelationship( transaction, relationships ); relationships.properties( propertyCursor ); int propertiesToFind = itemsToReturn;
@Override public Map<String, Object> getAllProperties() { KernelTransaction transaction = spi.kernelTransaction(); Map<String,Object> properties = new HashMap<>(); try { RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor propertyCursor = transaction.ambientPropertyCursor(); TokenRead token = transaction.tokenRead(); singleRelationship( transaction, relationships ); relationships.properties( propertyCursor ); while ( propertyCursor.next() ) { properties.put( token.propertyKeyName( propertyCursor.propertyKey() ), propertyCursor.propertyValue().asObjectCopy() ); } } catch ( PropertyKeyIdNotFoundKernelException e ) { throw new IllegalStateException( "Property key retrieved through kernel API should exist.", e ); } return properties; }
singleRelationship( transaction, relationships ); relationships.properties( properties ); while ( properties.next() )
@Override public Object getProperty( String key, Object defaultValue ) { if ( null == key ) { throw new IllegalArgumentException( "(null) property key is not allowed" ); } KernelTransaction transaction = spi.kernelTransaction(); RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor properties = transaction.ambientPropertyCursor(); int propertyKey = transaction.tokenRead().propertyKey( key ); if ( propertyKey == TokenRead.NO_TOKEN ) { return defaultValue; } singleRelationship( transaction, relationships ); relationships.properties( properties ); while ( properties.next() ) { if ( propertyKey == properties.propertyKey() ) { Value value = properties.propertyValue(); return value == Values.NO_VALUE ? defaultValue : value.asObjectCopy(); } } return defaultValue; }
@Override public boolean hasProperty( String key ) { if ( null == key ) { return false; } KernelTransaction transaction = spi.kernelTransaction(); int propertyKey = transaction.tokenRead().propertyKey( key ); if ( propertyKey == TokenRead.NO_TOKEN ) { return false; } RelationshipScanCursor relationships = transaction.ambientRelationshipCursor(); PropertyCursor properties = transaction.ambientPropertyCursor(); singleRelationship( transaction, relationships ); relationships.properties( properties ); while ( properties.next() ) { if ( propertyKey == properties.propertyKey() ) { return true; } } return false; }