Package com.tinkerpop.blueprints.pgm

Examples of com.tinkerpop.blueprints.pgm.Vertex


   *            object
   * @return the
   */
  public static Vertex getVertexForTuple(AbstractBluePrintsBackedFinderService<? extends Graph, ?, ?> service, ServiceRepository repository, Object value,
          Map<String, Object> objectsBeingUpdated) {
    Vertex returned = null;
    // Now distinct behaviour between known objects and unknown ones
    Class<? extends Object> valueClass = value.getClass();
    if (Tuples.containsKey(valueClass)) {
      TupleTransformer transformer = Tuples.get(valueClass);
      returned = transformer.getVertexFor(service, valueClass.cast(value), objectsBeingUpdated);
View Full Code Here


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

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

  public Vertex getVertexFor(Object value, CascadeType cascade, Map<String, Object> objectsBeingUpdated) {
    boolean allowIdGeneration = CascadeType.PERSIST.equals(cascade) || CascadeType.MERGE.equals(cascade);
    // Here we suppose the service is the right one for the job (which may
    // not be the case)
    if (containedClass.isInstance(value)) {
      Vertex returned = getIdVertexFor(containedClass.cast(value), allowIdGeneration);
      if (returned == null) {
        doUpdate(containedClass.cast(value), cascade, objectsBeingUpdated);
        returned = getIdVertexFor(containedClass.cast(value), allowIdGeneration);
      } else {
        // vertex already exist, but maybe object needs an update
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

  }

  public void loadCollection(Collection collection, Map<String, Object> objectsBeingAccessed) {
    try {
      for(Edge e : rootVertex.getOutEdges(GraphUtils.getEdgeNameFor(property))) {
        Vertex value = e.getInVertex();
        Object temporaryValue = GraphUtils.createInstance(classLoader, value);
        if(repository.containsKey(temporaryValue.getClass())) {
          FinderCrudService service = repository.get(temporaryValue.getClass());
          if (service instanceof BluePrintsBackedFinderService) {
            BluePrintsBackedFinderService blueprints= (BluePrintsBackedFinderService) service;
View Full Code Here

   * Local delete implementation
   * @param toDelete
   */
  private void doDelete(DataType toDelete, Map<String, Object> objectsBeingAccessed) {
    String vertexId = getIdVertexId(toDelete, idProperty);
    Vertex objectVertex = GraphUtils.locateVertex(database, Properties.vertexId.name(), vertexId);
    if(objectVertex!=null) {
      Map<Property, Collection<CascadeType>> containedProperties = getContainedProperties(toDelete);
      for(Property p : containedProperties.keySet()) {
        Class<?> rawPropertyType = p.getType();
        Collection<CascadeType> toCascade = containedProperties.get(p);
View Full Code Here

    Iterable<Edge> edges = objectVertex.getOutEdges(edgeNameFor);
    if (logger.isLoggable(Level.FINEST)) {
      logger.log(Level.FINEST, "deleting edge "+edgeNameFor+" of "+objectVertex.getProperty(Properties.vertexId.name()));
    }
    for(Edge e : edges) {
      Vertex valueVertex = e.getInVertex();
      database.removeEdge(e);
      // Now what to do with vertex ? Delete it ?
      if(toCascade.contains(CascadeType.REMOVE)) {
        // yes, delete it forever (but before, see if there aren't more datas to delete
        deleteOutEdgeVertex(objectVertex, valueVertex, p.get(toDelete), objectsBeingAccessed);
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.pgm.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.