Package org.neo4j.kernel.impl.nioneo.store

Examples of org.neo4j.kernel.impl.nioneo.store.RelationshipRecord


    }

    @Override
    public Map<String, Object> getRelationshipProperties( long relId )
    {
        RelationshipRecord record = getRelationshipRecord( relId );
        if ( record.getNextProp() != Record.NO_NEXT_PROPERTY.intValue() )
        {
            return getPropertyChain( record.getNextProp() );
        }
        return Collections.emptyMap();
    }
View Full Code Here


        created++;
    }

    @Override
    public boolean update(long relId, boolean outgoing, long prevId, long nextId) {
        RelationshipRecord record = relationshipStore.getLightRel(relId);
        if (record==null) return false;
        if (outgoing) {
            record.setFirstPrevRel(prevId);
            record.setFirstNextRel(nextId);
        } else {
            record.setSecondPrevRel(prevId);
            record.setSecondNextRel(nextId);
        }
        updateRecord(record);
        updated++;
        return true;
    }
View Full Code Here

        flush();
    }

    private RelationshipRecord createRecord(long from, Relationship relationship, long prevId, long nextId) {
        long id = relationship.id;
        RelationshipRecord relRecord = relationship.outgoing() ?
                    new RelationshipRecord( id, from, relationship.other(), relationship.type ) :
                    new RelationshipRecord( id, relationship.other(), from,  relationship.type );
        relRecord.setInUse(true);
        relRecord.setCreated();
        if (relationship.outgoing()) {
            relRecord.setFirstPrevRel(prevId);
            relRecord.setFirstNextRel(nextId);
        } else {
            relRecord.setSecondPrevRel(prevId);
            relRecord.setSecondNextRel(nextId);
        }
        relRecord.setNextProp(relationship.firstPropertyId);
        return relRecord;
    }
View Full Code Here

        updateRecord(createRecord(nodeId, relationship,prevId,nextId));
    }

    @Override
    public void update(long relId, boolean outgoing, long prevId, long nextId) {
        RelationshipRecord record = relationshipStore.getRecord(relId);
        if (outgoing) {
            record.setFirstPrevRel(prevId);
            record.setFirstNextRel(nextId);
        } else {
            record.setSecondPrevRel(prevId);
            record.setSecondNextRel(nextId);
        }
        updateRecord(record);
    }
View Full Code Here

        flush();
    }

    private RelationshipRecord createRecord(long from, Relationship relationship, long prevId, long nextId) {
        long id = relationship.id;
        RelationshipRecord relRecord = relationship.outgoing() ?
                    new RelationshipRecord( id, from, relationship.other(), relationship.type ) :
                    new RelationshipRecord( id, relationship.other(), from,  relationship.type );
        relRecord.setInUse(true);
        relRecord.setCreated();
        if (relationship.outgoing()) {
            relRecord.setFirstPrevRel(prevId);
            relRecord.setFirstNextRel(nextId);
        } else {
            relRecord.setSecondPrevRel(prevId);
            relRecord.setSecondNextRel(nextId);
        }
        relRecord.setNextProp(relationship.firstPropertyId);
        return relRecord;
    }
View Full Code Here

    @Override
    public void setRelationshipProperty( long relationship,
            String propertyName, Object propertyValue )
    {
        RelationshipRecord relRec = getRelationshipRecord(relationship);
        if ( setPrimitiveProperty(relRec, propertyName, propertyValue) )
        {
            getRelationshipStore().updateRecord( relRec );
        }
    }
View Full Code Here

    @Override
    public void removeRelationshipProperty( long relationship,
            String propertyName )
    {
        RelationshipRecord relationshipRec = getRelationshipRecord( relationship );
        if ( removePrimitiveProperty( relationshipRec, propertyName ) )
        {
            getRelationshipStore().updateRecord( relationshipRec );
        }
    }
View Full Code Here

        if ( typeId == -1 )
        {
            typeId = createNewRelationshipType( type.name() );
        }
        long id = getRelationshipStore().nextId();
        RelationshipRecord record = new RelationshipRecord( id, node1, node2, typeId );
        record.setInUse( true );
        record.setCreated();
        connectRelationship( firstNode, secondNode, record );
        getNodeStore().updateRecord( firstNode );
        getNodeStore().updateRecord( secondNode );
        record.setNextProp( createPropertyChain( properties ) );
        getRelationshipStore().updateRecord( record );
        return id;
    }
View Full Code Here

    private void connect( NodeRecord node, RelationshipRecord rel )
    {
        if ( node.getNextRel() != Record.NO_NEXT_RELATIONSHIP.intValue() )
        {
            RelationshipRecord nextRel = getRelationshipStore().getRecord( node.getNextRel() );
            boolean changed = false;
            if ( nextRel.getFirstNode() == node.getId() )
            {
                nextRel.setFirstPrevRel( rel.getId() );
                changed = true;
            }
            if ( nextRel.getSecondNode() == node.getId() )
            {
                nextRel.setSecondPrevRel( rel.getId() );
                changed = true;
            }
            if ( !changed )
            {
                throw new InvalidRecordException( node + " dont match " + nextRel );
View Full Code Here

    @Override
    public void setRelationshipProperties( long rel,
        Map<String,Object> properties )
    {
        RelationshipRecord record = getRelationshipRecord(rel);
        if ( record.getNextProp() != Record.NO_NEXT_PROPERTY.intValue() )
        {
            deletePropertyChain( record.getNextProp() );
            /*
             * See setNodeProperties above for an explanation of what goes on
             * here
             */
            record.setNextProp( Record.NO_NEXT_PROPERTY.intValue() );
            getRelationshipStore().updateRecord( record );
        }
        record.setNextProp( createPropertyChain( properties ) );
        getRelationshipStore().updateRecord( record );
    }
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.impl.nioneo.store.RelationshipRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.