Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2013 GraphAware
  *
  * This file is part of GraphAware.
  *
  * GraphAware 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
 * <http://www.gnu.org/licenses/>.
 */
package com.graphaware.tx.event.improved.api;
ImprovedTransactionData with filtering capabilities defined by com.graphaware.common.policy.InclusionPolicies, delegating to com.graphaware.tx.event.improved.data.filtered.FilteredNodeTransactionData and com.graphaware.tx.event.improved.data.filtered.FilteredRelationshipTransactionData.

Results of methods returning java.util.Collections and java.util.Maps will be filtered. boolean and single object returning methods will always return the full truth no matter the policies. So for example:

com.graphaware.tx.event.improved.data.BaseImprovedTransactionData.getAllCreatedNodes() can return 5 nodes, but com.graphaware.tx.event.improved.data.BaseImprovedTransactionData.hasBeenCreated(org.neo4j.graphdb.Node) can return true for more of them, as it ignores the filtering.

When traversing the graph using an object returned by this API (such as com.graphaware.tx.event.improved.propertycontainer.filtered.FilteredNode), nodes, properties, and relationships not included by the com.graphaware.common.policy.InclusionPolicies will be excluded. The only exception to this are relationship start and end nodes - they are returned even if they would normally be filtered out. This is a design decision in order to honor the requirement that relationships must have start and end node.

    private final InclusionPolicies inclusionPolicies;
    private final NodeTransactionData nodeTransactionData;
Construct a new filtered transaction data.

Parameters:
transactionDataContainer container for original unfiltered transaction data.
inclusionPolicies policies for filtering.
    public FilteredTransactionData(TransactionDataContainer transactionDataContainerInclusionPolicies inclusionPolicies) {
        this. = inclusionPolicies;
         = new FilteredNodeTransactionData(transactionDataContainer.getNodeTransactionData(), inclusionPolicies);
         = new FilteredRelationshipTransactionData(transactionDataContainer.getRelationshipTransactionData(), inclusionPolicies);
    }

    
    @Override
        return ;
    }

    
    @Override
        return ;
    }

    
    @Override
    public boolean mutationsOccurred() {
        //overridden for optimization - we don't want to load things (and especially properties) if we don't need to
        return (!.getNodeInclusionPolicy().equals(IncludeNoNodes.getInstance()) && !getAllCreatedNodes().isEmpty())
                || (!.getRelationshipInclusionPolicy().equals(IncludeNoRelationships.getInstance()) && !getAllCreatedRelationships().isEmpty())
                || (!.getNodeInclusionPolicy().equals(IncludeNoNodes.getInstance()) && !getAllDeletedNodes().isEmpty())
                || (!.getRelationshipInclusionPolicy().equals(IncludeNoRelationships.getInstance()) && !getAllDeletedRelationships().isEmpty())
                || (!.getNodePropertyInclusionPolicy().equals(IncludeNoNodeProperties.getInstance()) && !getAllChangedNodes().isEmpty())
                || (!.getRelationshipPropertyInclusionPolicy().equals(IncludeNoRelationshipProperties.getInstance()) && !getAllChangedRelationships().isEmpty());
    }
New to GrepCode? Check out our FAQ X