private void assertNodeExists( long sourceNode ) throws EntityNotFoundException { if ( !allStoreHolder.nodeExists( sourceNode ) ) { throw new EntityNotFoundException( EntityType.NODE, sourceNode ); } }
private void singleNode( long node ) throws EntityNotFoundException { allStoreHolder.singleNode( node, nodeCursor ); if ( !nodeCursor.next() ) { throw new EntityNotFoundException( EntityType.NODE, node ); } }
private void singleRelationship( long relationship ) throws EntityNotFoundException { allStoreHolder.singleRelationship( relationship, relationshipCursor ); if ( !relationshipCursor.next() ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationship ); } }
private static void singleNode( Read read, NodeCursor nodeCursor, long node ) throws EntityNotFoundException { read.singleNode( node, nodeCursor ); if ( !nodeCursor.next() ) { throw new EntityNotFoundException( EntityType.NODE, node ); } }
private static void singleRelationship( Read read, RelationshipScanCursor relationships, long relationship ) throws EntityNotFoundException { read.singleRelationship( relationship, relationships ); if ( !relationships.next() ) { throw new EntityNotFoundException( EntityType.NODE, relationship ); } } }
private void singleNode( KernelTransaction transaction, NodeCursor nodes ) { transaction.dataRead().singleNode( nodeId, nodes ); if ( !nodes.next() ) { throw new NotFoundException( new EntityNotFoundException( EntityType.NODE, nodeId ) ); } }
private void singleRelationship( KernelTransaction transaction, RelationshipScanCursor relationships ) { transaction.dataRead().singleRelationship( id, relationships ); if ( !relationships.next() ) { throw new NotFoundException( new EntityNotFoundException( EntityType.RELATIONSHIP, id ) ); } } }
@Override public Node getNodeById( long id ) { if ( id < 0 ) { throw new NotFoundException( format( "Node %d not found", id ), new EntityNotFoundException( EntityType.NODE, id ) ); } KernelTransaction ktx = statementContext.getKernelTransactionBoundToThisThread( true ); assertTransactionOpen( ktx ); try ( Statement ignore = ktx.acquireStatement() ) { if ( !ktx.dataRead().nodeExists( id ) ) { throw new NotFoundException( format( "Node %d not found", id ), new EntityNotFoundException( EntityType.NODE, id ) ); } return newNodeProxy( id ); } }
@Override public Relationship getRelationshipById( long id ) { if ( id < 0 ) { throw new NotFoundException( format( "Relationship %d not found", id ), new EntityNotFoundException( EntityType.RELATIONSHIP, id ) ); } KernelTransaction ktx = statementContext.getKernelTransactionBoundToThisThread( true ); assertTransactionOpen( ktx ); try ( Statement ignore = statementContext.get() ) { if ( !ktx.dataRead().relationshipExists( id ) ) { throw new NotFoundException( format( "Relationship %d not found", id ), new EntityNotFoundException( EntityType.RELATIONSHIP, id ) ); } return newRelationshipProxy( id ); } }
@Override public <EXCEPTION extends Exception> void relationshipVisit( long relationshipId, RelationshipVisitor<EXCEPTION> relationshipVisitor ) throws EntityNotFoundException, EXCEPTION { RelationshipData data = this.relationshipData.get( relationshipId ); if ( data == null ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationshipId ); } relationshipVisitor.visit( relationshipId, data.type, data.startNode, data.endNode ); }
@Override public <EXCEPTION extends Exception> void relationshipVisit( long relationshipId, RelationshipVisitor<EXCEPTION> relationshipVisitor ) throws EntityNotFoundException, EXCEPTION { // TODO Please don't create a record for this, it's ridiculous RelationshipRecord record = relationshipStore.getRecord( relationshipId, relationshipStore.newRecord(), CHECK ); if ( !record.inUse() ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationshipId ); } relationshipVisitor.visit( relationshipId, record.getType(), record.getFirstNode(), record.getSecondNode() ); }
@Override public void relationshipAddToExplicitIndex( String indexName, long relationship, String key, Object value ) throws ExplicitIndexNotFoundKernelException, EntityNotFoundException { ktx.assertOpen(); allStoreHolder.singleRelationship( relationship, relationshipCursor ); if ( relationshipCursor.next() ) { allStoreHolder.explicitIndexTxState().relationshipChanges( indexName ).addRelationship( relationship, key, value, relationshipCursor.sourceNodeReference(), relationshipCursor.targetNodeReference() ); } else { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationship ); } }
@Override public Value getNodePropertyValue( long nodeId, int propertyKeyId ) throws EntityNotFoundException { NodeRecord node = nodeStore.getRecord( nodeId, nodeStore.newRecord(), FORCE ); if ( !node.inUse() ) { throw new EntityNotFoundException( EntityType.NODE, nodeId ); } long firstPropertyId = node.getNextProp(); if ( firstPropertyId == Record.NO_NEXT_PROPERTY.intValue() ) { return Values.NO_VALUE; } for ( PropertyRecord propertyRecord : propertyStore.getPropertyRecordChain( firstPropertyId ) ) { PropertyBlock propertyBlock = propertyRecord.getPropertyBlock( propertyKeyId ); if ( propertyBlock != null ) { return propertyBlock.newPropertyValue( propertyStore ); } } return Values.NO_VALUE; }
private void assertNodeExists( long sourceNode ) throws EntityNotFoundException { if ( !allStoreHolder.nodeExists( sourceNode ) ) { throw new EntityNotFoundException( EntityType.NODE, sourceNode ); } }
private void singleNode( KernelTransaction transaction, NodeCursor nodes ) { transaction.dataRead().singleNode( nodeId, nodes ); if ( !nodes.next() ) { throw new NotFoundException( new EntityNotFoundException( EntityType.NODE, nodeId ) ); } }
private void singleRelationship( long relationship ) throws EntityNotFoundException { allStoreHolder.singleRelationship( relationship, relationshipCursor ); if ( !relationshipCursor.next() ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationship ); } }
private static void singleRelationship( Read read, RelationshipScanCursor relationships, long relationship ) throws EntityNotFoundException { read.singleRelationship( relationship, relationships ); if ( !relationships.next() ) { throw new EntityNotFoundException( EntityType.NODE, relationship ); } } }
private static void singleNode( Read read, NodeCursor nodeCursor, long node ) throws EntityNotFoundException { read.singleNode( node, nodeCursor ); if ( !nodeCursor.next() ) { throw new EntityNotFoundException( EntityType.NODE, node ); } }
private void singleRelationship( KernelTransaction transaction, RelationshipScanCursor relationships ) { transaction.dataRead().singleRelationship( id, relationships ); if ( !relationships.next() ) { throw new NotFoundException( new EntityNotFoundException( EntityType.RELATIONSHIP, id ) ); } } }
@Override public <EXCEPTION extends Exception> void relationshipVisit( long relationshipId, RelationshipVisitor<EXCEPTION> relationshipVisitor ) throws EntityNotFoundException, EXCEPTION { // TODO Please don't create a record for this, it's ridiculous RelationshipRecord record = relationshipStore.getRecord( relationshipId, relationshipStore.newRecord(), CHECK ); if ( !record.inUse() ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationshipId ); } relationshipVisitor.visit( relationshipId, record.getType(), record.getFirstNode(), record.getSecondNode() ); }