Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Transaction.finish()


            link = new Link(rel);
            noopRelationshipStrategy.postEntityCreation(rel, Link.class);
      tx.success();
      return thing;
    } finally {
      tx.finish();
    }
  }

  @NodeEntity
  public static class Thing {
View Full Code Here


            nodeTypeRepresentationStrategy.preEntityRemoval(node(thing));
            tx.success();
        }
        finally
        {
            tx.finish();
        }

    thingHits = typesIndex.get(IndexingNodeTypeRepresentationStrategy.INDEX_KEY, thing.getClass().getName());
    assertEquals(node(subThing), thingHits.getSingle());
    subThingHits = typesIndex.get(IndexingNodeTypeRepresentationStrategy.INDEX_KEY, subThing.getClass().getName());
View Full Code Here

            nodeTypeRepresentationStrategy.preEntityRemoval(node(subThing));
            tx.success();
        }
        finally
        {
            tx.finish();
        }

    thingHits = typesIndex.get(IndexingNodeTypeRepresentationStrategy.INDEX_KEY, thing.getClass().getName());
        assertNull(thingHits.getSingle());
    subThingHits = typesIndex.get(IndexingNodeTypeRepresentationStrategy.INDEX_KEY, subThing.getClass().getName());
View Full Code Here

      nodeTypeRepresentationStrategy.postEntityCreation(n2, SubThing.class);
            subThing.setName("subThing");
      tx.success();
      return thing;
    } finally {
      tx.finish();
    }
  }

    @NodeEntity
    public static class Unrelated {
View Full Code Here

    Transaction tx = graphDatabaseService.beginTx();
    try {
      cleanDb();
      tx.success();
    } finally {
      tx.finish();
    }
  }
}
View Full Code Here

        try {
            removeNodes(result);
            clearIndex(result);
            tx.success();
        } finally {
            tx.finish();
        }
        return result;
    }

    private void removeNodes(Map<String, Object> result) {
View Full Code Here

            throw e;
        } catch (Exception e) {
            log.error("Transaction failed", e);
            throw new RuntimeException(e);
        } finally {
            trans.finish();
        }

    }

    public Node createUserIfNotExists(long twitterId) {
View Full Code Here

        NodeManager nodeManager = graphDatabase.getDependencyResolver().resolveDependency(NodeManager.class);
        PropertyContainer properties = nodeManager.getGraphProperties();
        Transaction transaction = graphDatabase.beginTx();
        properties.setProperty("any other property", "should be ignored");
        transaction.success();
        transaction.finish();

        assertEquals(genericMap("user1", RO), service.getUsers());

        service.setPermissionForUser("user2", RW);
        assertEquals(genericMap("user1", RO, "user2", RW), service.getUsers());
View Full Code Here

            Object result = properties.getProperty(userKey, "");
            String credentials = (result instanceof Boolean) ? "" : (String) result;
            tx.success();
            return credentials;
        } finally {
            tx.finish();
        }
    }

    private PropertyContainer getGraphProperties() {
            NodeManager nodeManager = graph.getDependencyResolver().resolveDependency(NodeManager.class);
View Full Code Here

            }
            transaction.success();
        } catch (Exception e) {
            transaction.failure();
        } finally {
            transaction.finish();
        }
    }

    public enum Permission {
        NONE, RO, RW
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.