Example usage for org.springframework.data.repository.core RepositoryMetadata getRepositoryInterface

List of usage examples for org.springframework.data.repository.core RepositoryMetadata getRepositoryInterface

Introduction

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

Prototype

Class<?> getRepositoryInterface();

Source Link

Document

Returns the repository interface.

Usage

From source file:net.sf.gazpachoquest.repository.support.DefaultRepositoryFactory.java

@Override
protected Class<?> getRepositoryBaseClass(final RepositoryMetadata metadata) {

    if (isQueryDslExecutor(metadata.getRepositoryInterface())) {
        return QueryDslJpaRepository.class;
    } else {/*from  ww  w  .jav a2s.co  m*/
        return GenericRepositoryImpl.class;
    }
}

From source file:org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.java

@Override
protected Class<?> getRepositoryBaseClass(RepositoryMetadata metadata) {
    if (isQueryDslRepository(metadata.getRepositoryInterface())) {
        throw new IllegalArgumentException("QueryDsl Support has not been implemented yet.");
    }/*from w  ww. ja va2 s .  c  o  m*/
    return SimpleDynamoDBPagingAndSortingRepository.class;
}

From source file:com.google.code.guice.repository.spi.CustomJpaRepositoryFactory.java

@Override
protected Class<?> getRepositoryBaseClass(RepositoryMetadata metadata) {
    if (isQueryDslExecutor(metadata.getRepositoryInterface())) {
        return SimpleQueryDslJpaRepositoryFactory.class;
    } else {//from  ww w .  j av a 2s  . c  o m
        return SimpleBatchStoreJpaRepository.class;
    }
}

From source file:com.luna.common.repository.support.SimpleBaseRepositoryFactoryBean.java

protected Class<?> getRepositoryBaseClass(RepositoryMetadata metadata) {
    if (isBaseRepository(metadata.getRepositoryInterface())) {
        return SimpleBaseRepository.class;
    }//w ww .ja v a  2  s  .c o  m
    return super.getRepositoryBaseClass(metadata);
}

From source file:com.github.dactiv.orm.core.spring.data.jpa.factory.BasicJpaRepositoryFactory.java

@Override
protected Class<?> getRepositoryBaseClass(RepositoryMetadata metadata) {
    if (isQueryDslExecutor(metadata.getRepositoryInterface())) {
        return QueryDslJpaRepository.class;
    } else {//from  w w w .  j a v a2 s.co  m
        return JpaSupportRepository.class;
    }
}

From source file:org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.java

protected EnableScanPermissions getEnableScanPermissions(RepositoryMetadata metadata) {
    return new EnableScanAnnotationPermissions(metadata.getRepositoryInterface());
}

From source file:com.github.dactiv.orm.core.spring.data.jpa.factory.BasicJpaRepositoryFactory.java

@Override
protected Object getTargetRepository(RepositoryMetadata metadata) {

    Class<?> repositoryInterface = metadata.getRepositoryInterface();
    JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());

    SimpleJpaRepository<?, ?> repo = null;

    if (isQueryDslExecutor(repositoryInterface)) {
        repo = new QueryDslJpaRepository(entityInformation, entityManager);
    } else {// w ww  . j  a v a 2  s  . c  om
        repo = new JpaSupportRepository(entityInformation, entityManager);
    }

    repo.setLockMetadataProvider(LockModeRepositoryPostProcessor.INSTANCE.getLockMetadataProvider());

    return repo;

}

From source file:egov.data.ibatis.repository.query.AnnotationBasedSqlMapQueryMethod.java

public AnnotationBasedSqlMapQueryMethod(Method method, RepositoryMetadata metadata, boolean paramAnnotation) {
    super(method, metadata);

    this.repositoryInterface = metadata.getRepositoryInterface();
    this.paramAnnotation = paramAnnotation;
    this.method = method;
}

From source file:com.luna.common.repository.support.SimpleBaseRepositoryFactoryBean.java

protected Object getTargetRepository(RepositoryMetadata metadata) {
    Class<?> repositoryInterface = metadata.getRepositoryInterface();

    if (isBaseRepository(repositoryInterface)) {

        JpaEntityInformation<M, ID> entityInformation = getEntityInformation(
                (Class<M>) metadata.getDomainType());
        SimpleBaseRepository repository = new SimpleBaseRepository<M, ID>(entityInformation, entityManager);

        SearchableQuery searchableQuery = AnnotationUtils.findAnnotation(repositoryInterface,
                SearchableQuery.class);
        if (searchableQuery != null) {
            String countAllQL = searchableQuery.countAllQuery();
            if (!StringUtils.isEmpty(countAllQL)) {
                repository.setCountAllQL(countAllQL);
            }//from ww  w .j av a  2  s .  co m
            String findAllQL = searchableQuery.findAllQuery();
            if (!StringUtils.isEmpty(findAllQL)) {
                repository.setFindAllQL(findAllQL);
            }
            Class<? extends SearchCallback> callbackClass = searchableQuery.callbackClass();
            if (callbackClass != null && callbackClass != SearchCallback.class) {
                repository.setSearchCallback(BeanUtils.instantiate(callbackClass));
            }

            repository.setJoins(searchableQuery.joins());

        }

        return repository;
    }
    return super.getTargetRepository(metadata);
}

From source file:com.google.code.guice.repository.spi.CustomJpaRepositoryFactory.java

@Override
protected JpaRepository<?, ?> getTargetRepository(RepositoryMetadata metadata, EntityManager entityManager) {
    Class<?> repositoryInterface = metadata.getRepositoryInterface();
    JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());

    JpaRepository repo;/* w  w  w.  ja  v  a 2  s  .  com*/
    if (isQueryDslExecutor(repositoryInterface)) {
        repo = queryDslJpaRepositoryFactory.create(entityInformation, entityManager);
    } else {
        repo = batchRepositoryFactory.create(entityInformation, entityManager);
    }

    return repo;
}