Package com.dooapp.gaedo.properties

Examples of com.dooapp.gaedo.properties.Property


        }
        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


    map(returned, data, new EntityFiller<DataType, InformerType>(
        repository, datastore));
    // Finally, if class supports migration, persists the field used as key
    if(migrator!=null) {
      String liveVersionFieldName = migrator.getLiveVersionFieldName();
      Property liveProperty = getInformer().get(liveVersionFieldName).getField();
      returned.setProperty(migrator.getPersistedVersionFieldName(), Utils.getDatastoreFieldName(liveProperty));
    }
    if (logger.isLoggable(Level.FINER)) {
      logger.finer("all data of " + data + " has been put");
    }
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

   */
  @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

    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

   * Get text associated to field part of basic expression
   * @param expression input expression
   * @return a view of the field
   */
  private String getFieldText(AbstractBasicExpression expression) {
    Property f = expression.getField();
    if(f==null)
      return "this";
    else
      return f.toGenericString();
  }
View Full Code Here

    map(returned, data, new EntityFiller<DataType, InformerType>(
        repository, datastore));
    // Finally, if class supports migration, persists the field used as key
    if(migrator!=null) {
      String liveVersionFieldName = migrator.getLiveVersionFieldName();
      Property liveProperty = getInformer().get(liveVersionFieldName).getField();
      returned.setProperty(migrator.getPersistedVersionFieldName(), Utils.getDatastoreFieldName(liveProperty));
    }
    if (logger.isLoggable(Level.FINER)) {
      logger.finer("all data of " + data + " has been put");
    }
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

   */
  @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();
        // Per default, no operation is cascaded
        CascadeType used = null;
        // However, if property supports that cascade type, we cascade operation
        if(entry.getValue().contains(cascade)) {
          used = cascade;
        }
        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

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.