Java 类org.neo4j.graphdb.event.TransactionData 实例源码

项目:neo4j-mobile-android    文件:LockReleaser.java   
public TransactionData getTransactionData()
{
    TransactionDataImpl result = new TransactionDataImpl();
    PrimitiveElement element = cowMap.get( getTransaction() );
    populateCreatedNodes( element, result );
    if ( element == null )
    {
        return result;
    }
    if ( element.nodes != null )
    {
        populateNodeRelEvent( element, result );
    }
    if ( element.relationships != null )
    {
        populateRelationshipPropertyEvents( element, result );
    }
    return result;
}
项目:neo4j-couchbase-connector    文件:Neo4jEventListener.java   
/**
 * @see org.neo4j.graphdb.event.TransactionEventHandler#beforeCommit(org.neo4j.graphdb.event.TransactionData)
 */
public Void beforeCommit(TransactionData data) throws Exception {
    return null;
}
项目:neo_listens    文件:MyTransactionEventHandler.java   
@Override
public Object beforeCommit(TransactionData transactionData) throws Exception {
    return null;
}
项目:neo_listens    文件:MyTransactionEventHandler.java   
@Override
public void afterCommit(TransactionData transactionData, Object o) {
    ex.submit(new SuspectRunnable(transactionData, db));
}
项目:neo_listens    文件:SuspectRunnable.java   
public SuspectRunnable (TransactionData transactionData, GraphDatabaseService graphDatabaseService) {
    td = transactionData;
    db = graphDatabaseService;
}
项目:neo4j-mobile-android    文件:NodeManager.java   
public TransactionData getTransactionData()
{
    return lockReleaser.getTransactionData();
}
项目:neo4j-timestamp    文件:TimestampTransactionEventHandler.java   
@Override
public T beforeCommit(TransactionData data) throws Exception {
  long currentTime = System.currentTimeMillis();
  updateParentTimestampsFor(data.assignedRelationshipProperties(), currentTime);
  updateParentTimestampsFor(data.assignedNodeProperties(), currentTime);

  // With removed properties, don't update when node is being deleted
  updateRemoveTimestampsFor(data.removedRelationshipProperties(), data.deletedRelationships(), currentTime);
  updateRemoveTimestampsFor(data.removedNodeProperties(), data.deletedNodes(), currentTime);

  updateTimestampsFor(data.createdNodes(), currentTime);

  if (this.addCreated){
    addCreatedTimestampFor(data.createdNodes(), currentTime);
  }

  // For created relationships, update both start and end node, and relationship itself
  Iterable<Relationship> createdRelationships = data.createdRelationships();
  Set<PropertyContainer> updatedPropertyContainers = null;
  for (Relationship relationship : createdRelationships) {
    if (updatedPropertyContainers == null)
      updatedPropertyContainers = new HashSet<PropertyContainer>();
    updatedPropertyContainers.add(relationship.getEndNode());
    updatedPropertyContainers.add(relationship.getStartNode());
  }
  updateTimestampsFor(updatedPropertyContainers, currentTime);
  updateTimestampsFor(createdRelationships, currentTime);

  if (this.addCreated){
    addCreatedTimestampFor(createdRelationships, currentTime);
  }

  // Process custom relationships
  if (customPropertyHandlers != null && !customPropertyHandlers.isEmpty()){
    for (TimestampCustomPropertyHandler cpr : customPropertyHandlers){
        for (PropertyEntry<Node> assignedProperty : data.assignedNodeProperties()){
            if (cpr.getCustomPropertyName() == assignedProperty.key()){
                // Assigned custom property found, process modifications
                updateCustomRelationshipModifiedTimestampsFor(
                        assignedProperty.entity(),
                        cpr.getModifiedRelationshipTypes(),
                        cpr.getDirection(),
                        currentTime);
            }
        }
        for (PropertyEntry<Node> removedProperty : data.removedNodeProperties()){
            if (cpr.getCustomPropertyName() == removedProperty.key()){
                // Removed custom property found, process modifications to relationships
                updateCustomRelationshipModifiedTimestampsFor(
                        removedProperty.entity(),
                        cpr.getModifiedRelationshipTypes(),
                        cpr.getDirection(),
                        currentTime);
            }               
        }
    }
  }

  return null;
}
项目:neo4j-timestamp    文件:TimestampTransactionEventHandler.java   
@Override
public void afterCommit(TransactionData data, java.lang.Object state) {
}
项目:neo4j-timestamp    文件:TimestampTransactionEventHandler.java   
@Override
public void afterRollback(TransactionData data, java.lang.Object state) {
}
项目:neo4j-couchbase-connector    文件:Neo4jEventListener.java   
/**
 * @see org.neo4j.graphdb.event.TransactionEventHandler#afterCommit(org.neo4j.graphdb.event.TransactionData,
 *      java.lang.Object)
 */
public void afterCommit(TransactionData data, Void state) {

    List<JsonDocument> jsonDocuments = buildJSONDocument(data);

    if (jsonDocuments != null) {

        sendJSONDocumentsToCouchbase(jsonDocuments);
    }
}
项目:neo4j-couchbase-connector    文件:Neo4jEventListener.java   
/**
 * 
 * @param data
 *          the data that has changed during the course of one transaction
 */
public List<JsonDocument> buildJSONDocument(TransactionData data) {

    LOGGER.debug("Starting transofrm data from Cypher to JSON...");

    Neo4jToCouchbaseTransformer transformer = new Neo4jToCouchbaseTransformer();

    List<JsonDocument> jsonDocuments = transformer.transform(data, this.db);

    return jsonDocuments;
}
项目:neo4j-couchbase-connector    文件:Neo4jEventListener.java   
/**
 * @see org.neo4j.graphdb.event.TransactionEventHandler#afterRollback(org.neo4j.graphdb.event.TransactionData,
 *      java.lang.Object)
 */
public void afterRollback(TransactionData data, Void state) {
}
项目:neo_listens    文件:MyTransactionEventHandler.java   
@Override
public void afterRollback(TransactionData transactionData, Object o) {

}