Examples of GraphObject


Examples of org.structr.core.GraphObject

    }

    if (key != null && value != null) {

      String id      = null;
      GraphObject existingNode  = null;

      try {

        // UUID is globally unique
        if (key.equals(GraphObject.id)) {
         
         
          //return true; // trust uniqueness
          existingNode = StructrApp.getInstance().get(value.toString());
          //existingNode = StructrApp.getInstance().nodeQuery(AbstractNode.class).and(key, value).getFirst();
         
        } else {
         
          existingNode = StructrApp.getInstance().nodeQuery(AbstractNode.class).and(key, value).getFirst();
        }

      } catch (FrameworkException fex) {

        // handle error
      }

      if (existingNode != null) {

        GraphObject foundNode = existingNode;
        if (foundNode.getId() != object.getId()) {

          id = foundNode.getUuid();

          errorBuffer.add(object.getType(), new UniqueToken(id, key, value));

          return false;
        }
View Full Code Here

Examples of org.structr.core.GraphObject

         
        }

      } else if (source instanceof GraphObject) {
       
        GraphObject obj = (GraphObject)source;
        if (propertyKey != null) {
         
          results = (Result<T>) app.nodeQuery(NodeInterface.class).and(propertyKey, obj.getProperty(propertyKey)).getResult();
         
         
        } else {
         
          // fetch property key for "id", may be different for AbstractNode and AbstractRelationship!
          PropertyKey<String> idProperty = StructrApp.getConfiguration().getPropertyKeyForDatabaseName(obj.getClass(), GraphObject.id.dbName());
         
          return (T) app.get(obj.getProperty(idProperty));
         
        }
       
       
      } else {
View Full Code Here

Examples of org.structr.core.GraphObject

    return null;
  }
 
  private T getTypedResult(Result<T> result, Class<T> type) throws FrameworkException {
   
    GraphObject obj = result.get(0);

    if(!type.isAssignableFrom(obj.getClass())) {
      throw new FrameworkException(type.getSimpleName(), new TypeToken(AbstractNode.base, type.getSimpleName()));
    }

    return result.get(0);
  }
View Full Code Here

Examples of org.structr.core.GraphObject

  }

  @Override
  public GraphObject get(final String uuid) throws FrameworkException {

    GraphObject entity = nodeQuery().uuid(uuid).includeDeletedAndHidden().getFirst();
    if (entity == null) {

      entity = relationshipQuery().uuid(uuid).getFirst();
    }
View Full Code Here

Examples of org.structr.core.GraphObject

    boolean readableByUser = false;

    for (Iterator<? extends GraphObject> it = nodes.iterator(); it.hasNext(); ) {

      GraphObject obj = it.next();

      if (obj instanceof AbstractNode) {

        AbstractNode n = (AbstractNode) obj;
View Full Code Here

Examples of org.structr.core.GraphObject

    return null;
  }
 
  private T getTypedResult(Result<T> result, Class<T> type) throws FrameworkException {
   
    GraphObject obj = result.get(0);

    if (!type.isAssignableFrom(obj.getClass())) {
      throw new FrameworkException(type.getSimpleName(), new TypeToken(AbstractNode.base, type.getSimpleName()));
    }

    return result.get(0);
  }
View Full Code Here

Examples of org.structr.core.GraphObject

      }

      if (exists) {

        GraphObject foundNode = result.get(0);
        if (foundNode.getId() != object.getId()) {

          id = ((AbstractNode) result.get(0)).getUuid();

          errorBuffer.add(object.getType(), new UniqueToken(id, key, value));
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.