Example usage for org.springframework.data.repository.core RepositoryInformation getDomainType

List of usage examples for org.springframework.data.repository.core RepositoryInformation getDomainType

Introduction

In this page you can find the example usage for org.springframework.data.repository.core RepositoryInformation getDomainType.

Prototype

Class<?> getDomainType();

Source Link

Document

Returns the domain class the repository is declared for.

Usage

From source file:com.create.mybatis.repository.support.MyBatisRepositoryFactory.java

@Override
@SuppressWarnings("unchecked")
protected Object getTargetRepository(final RepositoryInformation metadata) {
    final MyBatisEntityInformation<?, Serializable> entityInformation = getEntityInformation(
            metadata.getDomainType());
    return new SimpleMyBatisRepository(entityInformation, mapperProvider.getSqlSessionTemplate());
}

From source file:com._4dconcept.springframework.data.marklogic.repository.support.MarklogicRepositoryFactory.java

@Override
protected Object getTargetRepository(RepositoryInformation metadata) {
    MarklogicEntityInformation<?, Serializable> entityInformation = getEntityInformation(
            metadata.getDomainType());
    return getTargetRepositoryViaReflection(metadata, entityInformation, marklogicOperations);
}

From source file:net.daum.clix.springframework.data.rest.client.repository.RestRepositories.java

/**
 * Returns the {@link String} for the given resource path class.
 * // w  w w  .j  av a  2  s  .  c om
 * @param resourcePath
 *            must not be {@literal null}.
 * @return the {@link String} for the given resource path or {@literal null}
 *         if no repository registered for this resource path
 */
public String findDomainClassNameFor(String resourcePath) {
    RepositoryInformation repoInfo = findRepositoryInformationFor(resourcePath);
    return repoInfo == null ? null : repoInfo.getDomainType().getName();
}

From source file:com.frank.search.solr.repository.support.SolrRepositoryFactory.java

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Object getTargetRepository(RepositoryInformation metadata) {

    SolrOperations operations = this.solrOperations;
    if (factory != null) {
        SolrTemplate template = new SolrTemplate(factory);
        if (this.solrOperations.getConverter() != null) {
            template.setMappingContext(this.solrOperations.getConverter().getMappingContext());
        }/*from w ww . j  a  v  a 2 s.  c o m*/
        template.setSolrCore(SolrClientUtils.resolveSolrCoreName(metadata.getDomainType()));
        addSchemaCreationFeaturesIfEnabled(template);
        template.afterPropertiesSet();
        operations = template;
    }

    SimpleSolrRepository repository = getTargetRepositoryViaReflection(metadata,
            getEntityInformation(metadata.getDomainType()), operations);
    repository.setEntityClass(metadata.getDomainType());

    this.templateHolder.add(metadata.getDomainType(), operations);
    return repository;
}

From source file:net.daum.clix.springframework.data.rest.client.repository.RestRepositories.java

/**
 * Creates a new {@link RestRepositories} instance by looking up the
 * repository instances and meta information from the given
 * {@link ListableBeanFactory}.//from  w  ww  .j  av a 2 s  .c om
 * 
 * @param factory
 *            must not be {@literal null}.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public RestRepositories(ListableBeanFactory factory) {

    Assert.notNull(factory);

    Collection<RestRepositoryFactoryBean> providers = BeanFactoryUtils
            .beansOfTypeIncludingAncestors(factory, RestRepositoryFactoryBean.class, true, false).values();

    for (RepositoryFactoryInformation<Object, Serializable> info : providers) {

        RepositoryInformation information = info.getRepositoryInformation();
        Class repositoryInterface = information.getRepositoryInterface();

        if (CrudRepository.class.isAssignableFrom(repositoryInterface)) {
            Class<CrudRepository<Object, Serializable>> objectType = repositoryInterface;
            CrudRepository<Object, Serializable> repository = BeanFactoryUtils
                    .beanOfTypeIncludingAncestors(factory, objectType);

            this.domainClassToBeanName.put(information.getDomainType(), info);
            this.resourcePathToBeanName.put(getResourcePath(repositoryInterface), info);
            this.repositories.put(info, repository);

        }
    }
}