Package com.tinkerpop.blueprints

Examples of com.tinkerpop.blueprints.Vertex


          Map<String, Object> objectsBeingUpdated) {
    // First step is to build an id for given tuple by concatenating key and value id (which is hopefully done separately)
    String entryVertexId = getIdOfTuple(service.getRepository(), cast);
    // No need to memorize updated version
    String className = cast.getClass().getName();
    Vertex objectVertex = service.loadVertexFor(entryVertexId, className);
    persister.performUpdate(service, entryVertexId, objectVertex, getContainedClass(), getContainedProperties(), cast, cascade, objectsBeingUpdated);
    if(objectVertex==null)
      objectVertex = service.loadVertexFor(entryVertexId, className);
    return objectVertex;
  }
View Full Code Here


      if(needToSort)
        Collections.sort(edges, COLLECTION_EDGE_COMPARATOR);
     
      // Now that everything is in order, we can load the real collection
      for(Edge e : edges) {
        Vertex value = e.getVertex(Direction.IN);
        try {
          Object temporaryValue = GraphUtils.createInstance(driver, strategy, classLoader, value, property.getType(), repository, objectsBeingAccessed);
          if(repository.containsKey(temporaryValue.getClass())) {
            FinderCrudService service = repository.get(temporaryValue.getClass());
            if (service instanceof AbstractBluePrintsBackedFinderService) {
View Full Code Here

  }

  public void loadMap(Map map, Map<String, Object> objectsBeingAccessed) {
    try {
      for (Edge e : strategy.getOutEdgesFor(rootVertex, property)) {
        Vertex value = e.getVertex(Direction.IN);
        // Value is always a serialized map entry, so deserialize it
        // with magic !
        try {
          Map.Entry temporaryValue = (Entry) GraphUtils.createInstance(driver, strategy, classLoader, value, property.getType(), repository, objectsBeingAccessed);
          map.put(temporaryValue.getKey(), temporaryValue.getValue());
View Full Code Here

   * @param value
   * @return
   */
  public Vertex getVertexFor(GraphDatabaseDriver driver, Type value, CascadeType cascade) {
    String vertexId = getVertexId(value);
    Vertex returned = driver.loadVertexFor(vertexId, value.getClass().getName());
    // If vertex doesn't exist (and cascade allow its creation) ... load it !
    if(returned==null && GraphUtils.canCreateVertex(cascade)) {
      returned = driver.createEmptyVertex(value.getClass(), vertexId, value);
      driver.setValue(returned, getVertexValue(value));
    }
View Full Code Here

                                   * no id
                                   * generation
                                   * on delete
                                   */);
    Class<? extends Object> toDeleteClass = toDelete.getClass();
    Vertex objectVertex = loadVertexFor(vertexId, toDeleteClass.getName());
    if (objectVertex != null) {
      Map<Property, Collection<CascadeType>> containedProperties = strategy.getContainedProperties(toDelete, objectVertex, CascadeType.REMOVE);
      persister.performDelete(this, vertexId, objectVertex, toDeleteClass, containedProperties, toDelete, CascadeType.REMOVE, objectsBeingAccessed);
    }
  }
View Full Code Here

   */
  private DataType doUpdate(DataType toUpdate, CascadeType cascade, Map<String, Object> treeMap) {
    boolean generatesId = strategy.isIdGenerationRequired() ? (CascadeType.PERSIST == cascade) : false;
    String objectVertexId = getIdVertexId(toUpdate, generatesId);
    Class<? extends Object> toUpdateClass = toUpdate.getClass();
    Vertex objectVertex = loadVertexFor(objectVertexId, toUpdateClass.getName());
    Map<Property, Collection<CascadeType>> containedProperties = strategy.getContainedProperties(toUpdate, objectVertex, cascade);
    return (DataType) persister.performUpdate(this, objectVertexId, objectVertex, toUpdateClass, containedProperties, toUpdate, cascade,
            treeMap);
  }
View Full Code Here

   * @param allowIdGeneration true if null id should be replaced by a new one
   * @return a vertex for an instance of the given object. Under some rare circumstances, this vertex may be null.
   */
  protected Vertex getVertexForInstanceOfDataType(Object value, CascadeType cascade, Map<String, Object> objectsBeingUpdated, boolean allowIdGeneration) {
    // was there any vertex prior to that call ? (don't worry, it will be used later)
    Vertex existing = getIdVertexFor(containedClass.cast(value), false);
    Vertex returned = null;
    if(existing==null) {
      returned = getIdVertexFor(containedClass.cast(value), allowIdGeneration);
    } else {
      returned = existing;
    }
View Full Code Here

   *            during loading, but is absolutely NOT a persistent cache
   * @see #loadObject(String, Vertex, Map)
   */
  public DataType loadObject(String objectVertexId, Map<String, Object> objectsBeingAccessed) {
    // If cast fails, well, that's some fuckin mess, no ?
    Vertex objectVertex = loadVertexFor(objectVertexId, containedClass.getName());
    return persister.loadObject(this, objectVertexId, objectVertex, objectsBeingAccessed);
  }
View Full Code Here

   */
  @Override
  public DataType findById(final Object... id) {
    // make sure entered type is a valid one
    String vertexIdValue = strategy.getAsId(id[0]);
    Vertex rootVertex = loadVertexFor(vertexIdValue, containedClass.getName());
    if (rootVertex == null) {
            // root vertex couldn't be found directly, mostly due to
            // https://github.com/Riduidel/gaedo/issues/11
            // So perform the longer (but always working) query
            return find().matching(new QueryBuilder<InformerType>() {
View Full Code Here

          TransactionalOperation<Boolean, DataType, InformerType> operation = new TransactionalOperation<Boolean, DataType, InformerType>(this) {

            @Override
            protected Boolean doPerform() {
              String idVertexId = getIdVertexId(value, strategy.isIdGenerationRequired());
              Vertex returned = getDriver().createEmptyVertex(value.getClass(), idVertexId, value);
              getDriver().setValue(returned, idVertexId);
              return true;
            }
          };
          return operation.perform();
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.Vertex

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.