Package org.structr.core.graph

Examples of org.structr.core.graph.NodeService


  @Override
  public void index(GraphObject entity, Object value) {

    if (entity instanceof AbstractNode) {

      NodeService nodeService = Services.getInstance().getService(NodeService.class);
      AbstractNode node       = (AbstractNode)entity;
      Node dbNode             = node.getNode();

      for (NodeIndex indexName : nodeIndices()) {

        Index<Node> index = nodeService.getNodeIndex(indexName);
        if (index != null) {

          try {

            synchronized (index) {

              index.remove(dbNode, dbName);

              if (value != null && !StringUtils.isBlank(value.toString())) {
                  index.add(dbNode, dbName, value);

              } else if (isIndexedWhenEmpty()) {

                value = getValueForEmptyFields();
                if (value != null) {

                  index.add(dbNode, dbName, value);
                }
              }
            }

          } catch (Throwable t) {

            logger.log(Level.INFO, "Unable to index property with dbName {0} and value {1} of type {2} on {3}: {4}", new Object[] { dbName, value, this.getClass().getSimpleName(), entity, t } );
          }
        }
      }

    } else {

      NodeService nodeService  = Services.getInstance().getService(NodeService.class);
      AbstractRelationship rel = (AbstractRelationship)entity;
      Relationship dbRel       = rel.getRelationship();

      for (RelationshipIndex indexName : relationshipIndices()) {

        Index<Relationship> index = nodeService.getRelationshipIndex(indexName);
        if (index != null) {

          try {

            synchronized (index) {
View Full Code Here

TOP

Related Classes of org.structr.core.graph.NodeService

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.