Package org.springframework.data.repository.support

Examples of org.springframework.data.repository.support.Repositories


   * @see DATAREST-112
   */
  @Test
  public void usesPropertyNameAsRelForPropertyResourceMapping() {

    Repositories repositories = new Repositories(factory);
    PersistentEntity<?, ?> entity = repositories.getPersistentEntity(Person.class);
    PersistentProperty<?> property = entity.getPersistentProperty("siblings");

    ResourceMetadata metadata = mappings.getMappingFor(Person.class);
    ResourceMapping mapping = metadata.getMappingFor(property);

View Full Code Here


  DomainObjectMerger merger;

  @Before
  public void setUp() {
    this.merger = new DomainObjectMerger(new Repositories(context.getBeanFactory()), new DefaultConversionService());
  }
View Full Code Here

    if (o == null) {
      return null;
    }

    Class<?> domainType = o.getClass();
    Repositories repositories = repositoriesFactory.getObject();
    Errors errors = new ValidationErrors(domainType.getSimpleName(), o, repositories.getPersistentEntity(domainType));

    for (Validator v : getValidatorsForEvent(event)) {
      if (v.supports(domainType)) {
        LOGGER.debug("{}: {} with {}", event, o, v);
        ValidationUtils.invokeValidator(v, o, errors);
View Full Code Here

   * @see DATAMONGO-581
   */
  @Test
  public void exposesPersistentEntity() {

    Repositories repositories = new Repositories(context);
    PersistentEntity<?, ?> entity = repositories.getPersistentEntity(Person.class);
    assertThat(entity, is(notNullValue()));
    assertThat(entity, is(instanceOf(MongoPersistentEntity.class)));
  }
View Full Code Here

   * @see SGF-140
   */
  @Test
  public void exposesPersistentProperty() {

    Repositories repositories = new Repositories(context);
    PersistentEntity<?, ?> entity = repositories.getPersistentEntity(Person.class);
    assertThat(entity, is(notNullValue()));
  }
View Full Code Here

        setSingleton(false);
    }

    @Override
    protected Repositories createInstance() throws Exception {
        Repositories repositories = BeanUtils.instantiateClass(Repositories.class);
        configureRepositories(repositories);
        return repositories;
    }
View Full Code Here

     */
    @Override
    public Link getSelfLinkFor(Object instance) {
        Assert.notNull(instance, "Domain object must not be null!");

        Repositories repositories = repositories(this);

        Class instanceType = instance.getClass();
        PersistentEntity<?, ?> entity = repositories.getPersistentEntity(instanceType);

        if (entity == null) {
            throw new IllegalArgumentException(String.format("Cannot create self link for %s! No persistent entity found!", instanceType));
        }

        EntityInformation<Object, Serializable> entityInformation = repositories.getEntityInformationFor(instanceType);
        Serializable id = entityInformation.getId(instance);

        return entityLinks(this).linkToSingleResource(entity.getType(), id).withSelfRel();
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.repository.support.Repositories

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.