Package com.dooapp.gaedo.properties

Examples of com.dooapp.gaedo.properties.Property


   */
  @Override
  public boolean matches(Vertex examined) {
    // Navigates to the first target edge and perform etest when reached
    Vertex currentVertex = examined;
    Property finalProperty = null;
    for(Property currentProperty : path) {
      Iterator<Edge> edges = currentVertex.getOutEdges(GraphUtils.getEdgeNameFor(currentProperty)).iterator();
      if(edges.hasNext()) {
        currentVertex = edges.next().getInVertex();
      } else {
        return false;
      }
      finalProperty = currentProperty;
    }
    // TODO add automatic loading of value
    Object value = currentVertex.getProperty(Properties.value.name());
    return matches((ValueType) finalProperty.fromString(value.toString()));
  }
View Full Code Here


        }
        edgeLabelToProperty.get(edgeLabel).add(e);
      }
      for (GraphBasedPropertyBuilder<DataType> builder : edgeLabelToProperty.values()) {
        try {
          Property built = builder.build();
          // only add property if absent from properties laoded from the bean, as properties loaded from the bean are respectfull to initial data type
          if(!returned.containsKey(built))
            returned.put(built, StrategyUtils.extractCascadeOfJPAAnnotations(built));
        } catch(NoEdgeInNamedGraphsException e) {
          logger.info(e.getMessage());
View Full Code Here

      if(count>0) {
        GraphBasedPropertyBuilder<DataType> builder = new GraphBasedPropertyBuilder<DataType>(dataClass, driver, namedGraphs);
        for(Edge e : edges.get(Properties.label.name(), fieldName)) {
          builder.add(e);
        }
        Property used = builder.build();
        return delegate.getInformerFor(used);
      }
    }
    // TODO Auto-generated method stub
    throw new UnsupportedOperationException("GraphFieldLocator can't do a search for "+fieldName);
View Full Code Here

   */
  @Override
  public boolean matches(Vertex examined) {
    // Navigates to the first target edge and perform etest when reached
    Vertex currentVertex = examined;
    Property finalProperty = null;
    // Counting path length allows us to check if we expect a null value
    int currentPathLength = 0;
    for(Property currentProperty : path) {
      Iterator<Edge> edges = currentVertex.getOutEdges(GraphUtils.getEdgeNameFor(currentProperty)).iterator();
      if(edges.hasNext()) {
View Full Code Here

   * @param cascade cascade type used to perform this operation, depend if this method is called from a {@link #create(Object)} or an {@link #update(Object)}
   * @param objectsBeingAccessed cache of objects being accessed during that write
   */
  private <DataType> void updateProperties(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, Graph database, Object toUpdate, Vertex objectVertex, Map<Property, Collection<CascadeType>> containedProperties, CascadeType cascade, Map<String, Object> objectsBeingAccessed) {
    for(Map.Entry<Property, Collection<CascadeType>> entry : containedProperties.entrySet()) {
      Property p = entry.getKey();
      // Static properties are by design not written
      if(!p.hasModifier(Modifier.STATIC) && !Annotations.TRANSIENT.is(p)) {
        Class<?> rawPropertyType = p.getType();
        if(Collection.class.isAssignableFrom(rawPropertyType)) {
          if (logger.isLoggable(Level.FINEST)) {
            logger.log(Level.FINEST, "property "+p.getName()+" is considered a collection one");
          }
          updateCollection(service, database, p, toUpdate, objectVertex, cascade, objectsBeingAccessed);
          // each value should be written as an independant value
        } else if(Map.class.isAssignableFrom(rawPropertyType)) {
          if (logger.isLoggable(Level.FINEST)) {
            logger.log(Level.FINEST, "property "+p.getName()+" is considered a map one");
          }
          updateMap(service, database, p, toUpdate, objectVertex, cascade, objectsBeingAccessed);
        } else {
          updateSingle(service, database, p, toUpdate, objectVertex, cascade, objectsBeingAccessed);
        }
View Full Code Here

      builder.append("\t");
    }
    if(path!=null) {
      Iterator<Property> pathIter = path.iterator();
      while (pathIter.hasNext()) {
        Property property = (Property) pathIter.next();
        builder.append(property.getName());
        if(pathIter.hasNext()) {
          builder.append(".");
        }
      }
    }
View Full Code Here

    return arrayList;
  }
 
  private void getValues(Entry<Iterable<Vertex>, Iterable<Property>> entry, Iterator<Property> pathIterator, List<Vertex> vertexAccumulator) {
    if(pathIterator.hasNext()) {
      Property current = pathIterator.next();
      getValues(entry, pathIterator, vertexAccumulator);
      List<Vertex> toScan = new LinkedList<Vertex>(vertexAccumulator);
      // clear parameter to let it be populated by result
      vertexAccumulator.clear();
      for(Vertex v : toScan) {
View Full Code Here

   * @param usingProperty property that should be used to find the vertex in the graph (instead of simply relying upon valye type (which is especially useful for numbers). This property can be null
   * @return
   */
  private VertexValueRange findBestMatch(Entry<Iterable<Vertex>, Iterable<Property>> entry, AtomicLong edgesCount, ArrayList<Vertex> verticesToCountEdgesIn, Iterator<Property> pathIterator) {
    if(pathIterator.hasNext()) {
      Property current = pathIterator.next();
      VertexValueRange matching = findBestMatch(entry, edgesCount, verticesToCountEdgesIn, pathIterator);
      // If previous level already returned this entryscore, there is no chance for new one to have less edges ... or we guess so
      if(matching==this) {
        return matching;
      } else {
View Full Code Here

    boolean returned = getInitialReturned();
    if(path.size()==0) {
      // we've reeached the end
      return matchesVertex(examined, last);
    } else {
      Property evaluated = path.get(0);
      List<Property> remaining =  path.size()>1 ? path.subList(1, path.size()) : new LinkedList<Property>();
      Iterable<Edge> edges = examined.getOutEdges(GraphUtils.getEdgeNameFor(evaluated));
      for(Edge e : edges) {
        returned = combineReturnedWith(matchesCollection(e.getInVertex(), remaining, evaluated), returned);
      }
View Full Code Here

    Map<String, Object> valuesAsTree = (Map<String, Object>) Utils.getValuesAsTree(objectParams).get(RestServiceParams.OBJECT.getPrefix());
    Object created = service.getContainedClass().newInstance();
    Informer<?> informer = service.getInformer();
    for(Object field : informer.getAllFields()) {
      if (field instanceof Property) {
        Property property = (Property) field;
        if(valuesAsTree.containsKey(property.getName())) {
          property.set(created, property.fromString(valuesAsTree.get(property.getName()).toString()));
        }
      }
    }
    return service.create(created);
  }
View Full Code Here

TOP

Related Classes of com.dooapp.gaedo.properties.Property

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.