com.graphaware.tx.event.improved.data.BaseImprovedTransactionData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tx-api Show documentation
Show all versions of tx-api Show documentation
Improved Transaction API with Graph Snapshotting
The newest version!
/*
* Copyright (c) 2013-2020 GraphAware
*
* This file is part of the GraphAware Framework.
*
* GraphAware Framework is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of
* the GNU General Public License along with this program. If not, see
* .
*/
package com.graphaware.tx.event.improved.data;
import com.graphaware.common.util.Change;
import org.neo4j.graphdb.*;
import org.neo4j.graphdb.event.TransactionData;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static com.graphaware.common.util.EntityUtils.nodeToString;
import static com.graphaware.common.util.EntityUtils.relationshipToString;
/**
* Base-class for {@link com.graphaware.tx.event.improved.api.ImprovedTransactionData} implementations that delegates all work to
* {@link NodeTransactionData} and {@link RelationshipTransactionData} provided by subclasses.
*/
public abstract class BaseImprovedTransactionData {
private final TransactionData wrapped;
private final Transaction transaction;
public BaseImprovedTransactionData(TransactionData wrapped, Transaction transaction) {
this.wrapped = wrapped;
this.transaction = transaction;
}
public Transaction getTransaction() {
return transaction;
}
/**
* Get {@link NodeTransactionData} to delegate to.
*
* @return delegate.
*/
protected abstract NodeTransactionData getNodeTransactionData();
/**
* Get {@link RelationshipTransactionData} to delegate to.
*
* @return delegate.
*/
protected abstract RelationshipTransactionData getRelationshipTransactionData();
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#hasBeenCreated(org.neo4j.graphdb.Node)
*/
public boolean hasBeenCreated(Node node) {
return getNodeTransactionData().hasBeenCreated(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#getAllCreatedNodes()
*/
public Collection getAllCreatedNodes() {
return getNodeTransactionData().getAllCreated();
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#hasBeenDeleted(org.neo4j.graphdb.Node)
*/
public boolean hasBeenDeleted(Node node) {
return getNodeTransactionData().hasBeenDeleted(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#getDeleted(org.neo4j.graphdb.Node)
*/
public Node getDeleted(Node node) {
return getNodeTransactionData().getDeleted(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#getAllDeletedNodes()
*/
public Collection getAllDeletedNodes() {
return getNodeTransactionData().getAllDeleted();
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#hasBeenChanged(org.neo4j.graphdb.Node)
*/
public boolean hasBeenChanged(Node node) {
return getNodeTransactionData().hasBeenChanged(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#getChanged(org.neo4j.graphdb.Node)
*/
public Change getChanged(Node node) {
return getNodeTransactionData().getChanged(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#getAllChangedNodes()
*/
public Collection> getAllChangedNodes() {
return getNodeTransactionData().getAllChanged();
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#hasPropertyBeenCreated(org.neo4j.graphdb.Node, String)
*/
public boolean hasPropertyBeenCreated(Node node, String key) {
return getNodeTransactionData().hasPropertyBeenCreated(node, key);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#createdProperties(org.neo4j.graphdb.Node)
*/
public Map createdProperties(Node node) {
return getNodeTransactionData().createdProperties(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#hasPropertyBeenDeleted(org.neo4j.graphdb.Node, String)
*/
public boolean hasPropertyBeenDeleted(Node node, String key) {
return getNodeTransactionData().hasPropertyBeenDeleted(node, key);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#deletedProperties(org.neo4j.graphdb.Node)
*/
public Map deletedProperties(Node node) {
return getNodeTransactionData().deletedProperties(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#hasPropertyBeenChanged(org.neo4j.graphdb.Node, String)
*/
public boolean hasPropertyBeenChanged(Node node, String key) {
return getNodeTransactionData().hasPropertyBeenChanged(node, key);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#changedProperties(org.neo4j.graphdb.Node)
*/
public Map> changedProperties(Node node) {
return getNodeTransactionData().changedProperties(node);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#hasLabelBeenAssigned(org.neo4j.graphdb.Node, org.neo4j.graphdb.Label)
*/
public boolean hasLabelBeenAssigned(Node node, Label label) {
return getNodeTransactionData().hasLabelBeenAssigned(node, label);
}
/**
* @see com.graphaware.tx.event.improved.api.ImprovedTransactionData#assignedLabels(org.neo4j.graphdb.Node)
*/
public Set
© 2015 - 2024 Weber Informatics LLC | Privacy Policy