Package org.springframework.data.mapping.model

Examples of org.springframework.data.mapping.model.MappingException


        level = annotation.level();
        numeric = annotation.numeric();
    }

    private String determineLabelIndexName(Indexed annotation, Neo4jPersistentProperty property) {
        if (!annotation.indexName().isEmpty()) throw new MappingException("No index name allowed on label based indexes, property: "+ property.getOwner().getName()+"."+property.getName());
        Neo4jPersistentEntity<?> entity = property.getOwner();

        // NW StoredEntityType not available at this stage yet ....
        // only set when entity.updateStoredType(..) called
        StoredEntityType entityType = entity.getEntityType();
        switch (annotation.level()) {
            case CLASS:
                Class<?> declaringClass = property.getField().getDeclaringClass();
                return
                    (entityType != null)
                            ? entityType.findByTypeClass(declaringClass).getAlias().toString()
                            : doBestGuessLabelName(entity)// Not right but not sure what to do here
            case INSTANCE:
                return
                    (entityType != null)
                            ? entityType.getAlias().toString()
                            : doBestGuessLabelName(entity)// Not right but not sure what to do here
            case GLOBAL: throw new MappingException("No global index for label based indexes");
        }
        return entityType.getAlias().toString();
    }
View Full Code Here


            final PropertyContainer state = getPersistentState(value);
            if (state instanceof Node)
                return entityPersister.loadEntity(value, (Node) state, MappingPolicy.LOAD_POLICY, (Neo4jPersistentEntityImpl<T>) getPersistentEntity(targetType), this);
            if (state instanceof Relationship)
                return entityPersister.loadRelationshipEntity(value, (Relationship) state, MappingPolicy.LOAD_POLICY, (Neo4jPersistentEntityImpl<T>) getPersistentEntity(targetType), this);
            throw new MappingException("No state information available in " + value);
        }
    }
View Full Code Here

                }
                message = e.getMessage();
                sleep(50*(i+1));
            }
        }
        throw new MappingException("Could not make sure within ("+(System.currentTimeMillis()-start)+" ms) that the index for "+label+"("+prop+") is ONLINE, Failure: "+message);
    }
View Full Code Here

                for (String removedLabels : oldLabels) {
                    node.removeLabel(DynamicLabel.label(removedLabels));
                }
                return doReturn(newVal);
            }
            throw new MappingException("Error setting labels on "+entity);
        }
View Full Code Here

        public Object getValue(final Object entity, MappingPolicy mappingPolicy) {
            final PropertyContainer state = template.getPersistentState(entity);
            if (state instanceof Node) {
                return doReturn(getLabels((Node) state));
            }
            throw new MappingException("Error retrieving labels from "+entity);
        }
View Full Code Here

    }

    CassandraPersistentEntity<R> persistentEntity = (CassandraPersistentEntity<R>) mappingContext
        .getPersistentEntity(typeToUse);
    if (persistentEntity == null) {
      throw new MappingException("No mapping metadata found for " + rawType.getName());
    }

    return readEntityFromRow(persistentEntity, row);
  }
View Full Code Here

  @Override
  public <R> R read(Class<R> type, Object row) {
    if (row instanceof Row) {
      return readRow(type, (Row) row);
    }
    throw new MappingException("Unknown row object " + row.getClass().getName());
  }
View Full Code Here

    Class<?> beanClassLoaderClass = transformClassToBeanClassLoaderClass(source.getClass());
    CassandraPersistentEntity<?> entity = mappingContext.getPersistentEntity(beanClassLoaderClass);

    if (entity == null) {
      throw new MappingException("No mapping metadata found for " + source.getClass());
    }

    if (sink instanceof Insert) {
      writeInsertFromObject(source, (Insert) sink, entity);
    } else if (sink instanceof Update) {
      writeUpdateFromObject(source, (Update) sink, entity);
    } else if (sink instanceof Where) {
      writeDeleteWhereFromObject(source, (Where) sink, entity);
    } else {
      throw new MappingException("Unknown buildStatement " + sink.getClass().getName());
    }
  }
View Full Code Here

  public <T, ID extends Serializable> CassandraEntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {

    CassandraPersistentEntity<?> entity = mappingContext.getPersistentEntity(domainClass);

    if (entity == null) {
      throw new MappingException(String.format("Could not lookup mapping metadata for domain class %s!",
          domainClass.getName()));
    }

    return new MappingCassandraEntityInformation<T, ID>((CassandraPersistentEntity<T>) entity,
        cassandraTemplate.getConverter());
View Full Code Here

TOP

Related Classes of org.springframework.data.mapping.model.MappingException

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.