Package com.dooapp.gaedo.properties

Examples of com.dooapp.gaedo.properties.Property


    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


   * @param path
   * @return
   */
  private <Type> VertexSet load(Type expected, Iterable<Property> path) {
    LinkedList<Property> updatablePath = new LinkedList<Property>(CollectionUtils.asList(path));
    Property lastProperty = updatablePath.removeLast();
    // if value is a literal, well, it's time for an index lookup
    Class<Type> expectedClass = (Class<Type>) expected.getClass();
    if (expected != null && Literals.containsKey(expectedClass)) {
      // Yup : gladly using implementation as it provides a last() method !
      Index<Vertex> vertices = (Index<Vertex>) service.getDatabase().getIndex(IndexNames.VERTICES.getIndexName(), IndexNames.VERTICES.getIndexed());
      // stinky code fragment for collections : as each value is stored under
      // a key in the form propertyName:index, we have to iterate upon them
      String propertyKeyInIndex = null;
      String propertyValueInIndex = null;
      if (Collection.class.isAssignableFrom(lastProperty.getType())) {
        propertyKeyInIndex = GraphUtils.getEdgeNameFor(new LiteralInCollectionUpdaterProperty(lastProperty, expected, Updater.ELEMENT_IN_COLLECTION_MARKER));
        propertyValueInIndex = Updater.ELEMENT_IN_COLLECTION_MARKER_GRAPH_VALUE;
      } else {
        propertyKeyInIndex = GraphUtils.getEdgeNameFor(lastProperty);
        LiteralTransformer<Type> transformer = Literals.get(expectedClass);
        if(Literals.containsKey(lastProperty.getType())) {
          transformer = Literals.get(lastProperty.getType());
        }
        propertyValueInIndex = transformer.toString(expected);
      }
      VertexSet returned = new VertexSet().withPropertyPath(updatablePath);
      returned.setVertices(new IndexLazyLoader(vertices, propertyKeyInIndex, propertyValueInIndex));
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 = strategy.getOutEdgesFor(currentVertex, currentProperty).iterator();
      if(edges.hasNext()) {
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

     * @param objectsBeingAccessed map containing subgraph of objects currently being delete, this is used to avoid loops, and NOT as a cache
     */
    public <DataType> void performDelete(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, String objectVertexId, Vertex objectVertex, Class<?> valueClass, Map<Property, Collection<CascadeType>> containedProperties, DataType toDelete, CascadeType cascade, ObjectCache objectsBeingAccessed) {
        Graph database = service.getDatabase();
        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)) {
                // 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(used!=null) {
                  Class<?> rawPropertyType = p.getType();
                  Collection<CascadeType> toCascade = containedProperties.get(p);
                  if (Collection.class.isAssignableFrom(rawPropertyType)) {
                      if (logger.isLoggable(Level.FINEST)) {
                          logger.log(Level.FINEST, "property " + p.getName() + " is considered a collection one");
                      }
                      deleteCollection(service, database, p, toDelete, objectVertex, toCascade, 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");
                      }
                      deleteMap(service, database, p, toDelete, objectVertex, toCascade, objectsBeingAccessed);
                  } else {
                      deleteSingle(service, database, p, toDelete, objectVertex, toCascade, objectsBeingAccessed);
                  }
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, ObjectCache 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)) {
                // 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;
                }
                // We only perform operations on cascaded fields
                if(used!=null) {
                  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, used, 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, used, objectsBeingAccessed);
                  } else {
                      updateSingle(service, database, p, toUpdate, objectVertex, used, objectsBeingAccessed);
                  }
View Full Code Here

   * @return
   */
  public static IdManager createIdManager(Class<?> containedClass,
      DatastoreService datastore, ServiceRepository repository, PropertyProvider provider, HierarchyManager hierarchyManager) {
    logger.config("defining id manager");
    Property id = AnnotationUtils.locateIdField(provider, containedClass, Long.TYPE, Long.class, String.class);
    IdManager returned = null;
    if (Long.class.equals(id.getType())
            || Long.TYPE.equals(id.getType())) {
      returned = new LongIdManager(containedClass, datastore, provider, repository, hierarchyManager);
    }
    if (returned == null)
      throw new BadIdAnnotatedClassException(containedClass);
    return returned;
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

    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

   * @param declaring
   * @param properties
   * @return
   */
  public static Property getMigratorProperty(String liveVersionFieldName, String persistentVersionFieldName, Class declaring, Property[] properties) {
    Property liveVersion = null;
    for(Property p : properties) {
      if(p.getName().equals(liveVersionFieldName)) {
        liveVersion = p;
      }
    }
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.