Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.GraphDatabaseService


  @Override
  public void execute(Map<String, Object> attributes) throws FrameworkException {


    final GraphDatabaseService graphDb = StructrApp.getInstance().getService(NodeService.class).getGraphDb();
    final List<Node> toDelete          = new LinkedList<>();

    for (final Node node: GlobalGraphOperations.at(graphDb).getAllNodes()) {

      try {
View Full Code Here


  @Override
  public void execute(Map<String, Object> attributes) throws FrameworkException {

    try {

      final GraphDatabaseService graphDb = Services.getInstance().getService(NodeService.class).getGraphDb();
      final GlobalGraphOperations ggop  = GlobalGraphOperations.at(graphDb);
      final Iterable<Relationship> rels = ggop.getAllRelationships();
      final Iterable<Node> nodes        = ggop.getAllNodes();
      final App app                     = StructrApp.getInstance();
      final String fileName             = (String)attributes.get("name");
View Full Code Here

  //~--- methods --------------------------------------------------------

  public void test00DbAvailable() {

    GraphDatabaseService graphDb = graphDbCommand.execute();

    assertTrue(graphDb != null);
  }
View Full Code Here

  private static final ThreadLocal<TransactionReference> transactions = new ThreadLocal<>();
  private static final MultiSemaphore                    semaphore    = new MultiSemaphore();

  public TransactionCommand beginTx() {
   
    final GraphDatabaseService graphDb = (GraphDatabaseService) arguments.get("graphDb");
    TransactionReference tx            = transactions.get();
   
    if (tx == null) {
   
      // start new transaction
      tx = new TransactionReference(graphDb.beginTx());
     
      queues.set(new ModificationQueue());
      buffers.set(new ErrorBuffer());
      transactions.set(tx);
      currentCommand.set(this);
View Full Code Here

  //~--- methods --------------------------------------------------------
  @Override
  public void execute(Map<String, Object> attributes) throws FrameworkException {

    final String entityType = (String) attributes.get("type");
    final GraphDatabaseService graphDb = (GraphDatabaseService) arguments.get("graphDb");
    final SecurityContext superUserContext = SecurityContext.getSuperUserInstance();
    final NodeFactory nodeFactory = new NodeFactory(superUserContext);

    Class type = null;
    if (entityType != null) {
View Full Code Here

    return execute(properties);
  }
 
  public T execute(PropertyMap attributes) throws FrameworkException {

    GraphDatabaseService graphDb = (GraphDatabaseService) arguments.get("graphDb");
    Principal user               = securityContext.getUser(false);
    T node                       = null;

    if (graphDb != null) {

      Date now                            = new Date();

      // Determine node type
      PropertyMap properties     = new PropertyMap(attributes);
      Object typeObject          = properties.get(AbstractNode.type);
      Class nodeType             = typeObject != null ? SchemaHelper.getEntityClassForRawType(typeObject.toString()) : StructrApp.getConfiguration().getFactoryDefinition().getGenericNodeType();
      NodeFactory<T> nodeFactory = new NodeFactory<>(securityContext);
      boolean isCreation         = true;

      // Create node with type
      node = (T) nodeFactory.instantiateWithType(graphDb.createNode(), nodeType, isCreation);
      if(node != null) {
       
        TransactionCommand.nodeCreated(node);

        // set type
View Full Code Here

  //~--- methods --------------------------------------------------------

  @Override
  public void execute(final Map<String, Object> properties) throws FrameworkException {

    final GraphDatabaseService graphDb     = (GraphDatabaseService) arguments.get("graphDb");
    final SecurityContext superUserContext = SecurityContext.getSuperUserInstance();
    final NodeFactory nodeFactory          = new NodeFactory(superUserContext);

    final String type = (String)properties.get("type");
    if (StringUtils.isBlank(type)) {
View Full Code Here

public class GetAllRelationships extends NodeServiceCommand {

  public List<AbstractRelationship> execute() throws FrameworkException {

    RelationshipFactory relationshipFactory = new RelationshipFactory(securityContext);
    GraphDatabaseService graphDb            = (GraphDatabaseService)arguments.get("graphDb");

    if (graphDb != null) {

      return relationshipFactory.instantiate(GlobalGraphOperations.at(graphDb).getAllRelationships());
    }
View Full Code Here

  //~--- methods --------------------------------------------------------

  @Override
  public void execute(final Map<String, Object> properties) throws FrameworkException {

    final GraphDatabaseService graphDb     = (GraphDatabaseService) arguments.get("graphDb");
    final SecurityContext superUserContext = SecurityContext.getSuperUserInstance();
    final NodeFactory nodeFactory          = new NodeFactory(superUserContext, true, false);

    if (graphDb != null) {
View Full Code Here

  //~--- methods --------------------------------------------------------

  public void execute() throws FrameworkException {

    final GraphDatabaseService graphDb = (GraphDatabaseService) arguments.get("graphDb");
    final NodeFactory nodeFactory      = new NodeFactory(securityContext);

    if (graphDb != null) {

      final List<AbstractNode> result = new LinkedList<>();
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.GraphDatabaseService

Copyright © 2018 www.massapicom. 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.