Search in sources :

Example 1 with NodeEntity

use of org.neo4j.kernel.impl.core.NodeEntity in project neo4j by neo4j.

the class NodeEntityWrappingNodeValue method properties.

public MapValue properties(NodeCursor nodeCursor, PropertyCursor propertyCursor) {
    MapValue m = properties;
    if (m == null) {
        try {
            synchronized (this) {
                m = properties;
                if (m == null) {
                    // No DBHits for Virtual node hacks.
                    var nodeProperties = node instanceof NodeEntity ? ((NodeEntity) node).getAllProperties(nodeCursor, propertyCursor) : node.getAllProperties();
                    m = properties = ValueUtils.asMapValue(nodeProperties);
                }
            }
        } catch (NotFoundException | IllegalStateException | StoreFailureException e) {
            throw new ReadAndDeleteTransactionConflictException(NodeEntity.isDeletedInCurrentTransaction(node), e);
        }
    }
    return m;
}
Also used : StoreFailureException(org.neo4j.exceptions.StoreFailureException) NotFoundException(org.neo4j.graphdb.NotFoundException) MapValue(org.neo4j.values.virtual.MapValue) NodeEntity(org.neo4j.kernel.impl.core.NodeEntity)

Example 2 with NodeEntity

use of org.neo4j.kernel.impl.core.NodeEntity in project neo4j by neo4j.

the class NodeEntityWrappingNodeValue method labels.

public TextArray labels(NodeCursor nodeCursor) {
    TextArray l = labels;
    if (l == null) {
        try {
            synchronized (this) {
                l = labels;
                if (l == null) {
                    List<String> ls = new ArrayList<>();
                    // No DBHits for Virtual node hacks.
                    var nodeLabels = node instanceof NodeEntity ? ((NodeEntity) node).getLabels(nodeCursor) : node.getLabels();
                    for (Label label : nodeLabels) {
                        ls.add(label.name());
                    }
                    l = labels = Values.stringArray(ls.toArray(new String[0]));
                }
            }
        } catch (NotFoundException | IllegalStateException | StoreFailureException e) {
            throw new ReadAndDeleteTransactionConflictException(NodeEntity.isDeletedInCurrentTransaction(node), e);
        }
    }
    return l;
}
Also used : StoreFailureException(org.neo4j.exceptions.StoreFailureException) ArrayList(java.util.ArrayList) Label(org.neo4j.graphdb.Label) NotFoundException(org.neo4j.graphdb.NotFoundException) TextArray(org.neo4j.values.storable.TextArray) NodeEntity(org.neo4j.kernel.impl.core.NodeEntity)

Example 3 with NodeEntity

use of org.neo4j.kernel.impl.core.NodeEntity in project neo4j by neo4j.

the class TxStateTransactionDataViewTest method snapshot.

private TxStateTransactionDataSnapshot snapshot() {
    when(internalTransaction.newNodeEntity(anyLong())).thenAnswer(invocation -> new NodeEntity(internalTransaction, invocation.getArgument(0)));
    when(internalTransaction.newRelationshipEntity(anyLong())).thenAnswer(invocation -> new RelationshipEntity(internalTransaction, invocation.getArgument(0)));
    when(internalTransaction.newRelationshipEntity(anyLong(), anyLong(), anyInt(), anyLong())).thenAnswer(invocation -> new RelationshipEntity(internalTransaction, invocation.getArgument(0), invocation.getArgument(1), invocation.getArgument(2), invocation.getArgument(3)));
    return new TxStateTransactionDataSnapshot(state, ops, transaction);
}
Also used : RelationshipEntity(org.neo4j.kernel.impl.core.RelationshipEntity) NodeEntity(org.neo4j.kernel.impl.core.NodeEntity)

Aggregations

NodeEntity (org.neo4j.kernel.impl.core.NodeEntity)3 StoreFailureException (org.neo4j.exceptions.StoreFailureException)2 NotFoundException (org.neo4j.graphdb.NotFoundException)2 ArrayList (java.util.ArrayList)1 Label (org.neo4j.graphdb.Label)1 RelationshipEntity (org.neo4j.kernel.impl.core.RelationshipEntity)1 TextArray (org.neo4j.values.storable.TextArray)1 MapValue (org.neo4j.values.virtual.MapValue)1