• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Repositories类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.data.repository.support.Repositories的典型用法代码示例。如果您正苦于以下问题:Java Repositories类的具体用法?Java Repositories怎么用?Java Repositories使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Repositories类属于org.springframework.data.repository.support包,在下文中一共展示了Repositories类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: save

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public static Object save(Repositories repositories, Object domainObj) 
		throws HttpRequestMethodNotSupportedException {

	RepositoryInformation ri = findRepositoryInformation(repositories, domainObj.getClass());

	if (ri == null) {
		throw new ResourceNotFoundException();
	}

	Class<?> domainObjClazz = ri.getDomainType();
	
	if (domainObjClazz != null) {
		Method saveMethod = ri.getCrudMethods().getSaveMethod();
		if (saveMethod == null) {
			throw new HttpRequestMethodNotSupportedException("save");
		}
		domainObj = ReflectionUtils.invokeMethod(saveMethod, repositories.getRepositoryFor(domainObjClazz), domainObj);
	}

	return domainObj;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:22,代码来源:AbstractContentPropertyController.java


示例2: setUpRepositoryProviderMock

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public static Repositories setUpRepositoryProviderMock(Map<Class<?>, Repository<?, ?>> repositoriesMap)
{
	Repositories mockRepositories = Mockito.mock(Repositories.class);
	when(mockRepositories.getRepositoryFor(any())).thenAnswer(new Answer<Object>() {
		@Override
		public Object answer(InvocationOnMock invocation) throws Throwable
		{
			Class<?> entityClass = (Class<?>) invocation.getArguments()[0];
			Repository<?, ?> repository = repositoriesMap.get(entityClass);
			if (repository == null)
			{
				throw new IllegalArgumentException("Unsupported class: " + entityClass.getName());
			}
			return repository;
		}
	});
	RepositoryProvider.setRepositories(mockRepositories);
	return mockRepositories;
}
 
开发者ID:yonadev,项目名称:yona-server,代码行数:20,代码来源:JUnitUtil.java


示例3: find

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@SuppressWarnings(value = "unchecked")
public CrudRepository<Object, Serializable> find(@NotNull Class<?> domainClass) {
    Repositories repositories = new Repositories(listableBeanFactory);

    Iterator<Class<?>> it = repositories.iterator();
    while (it.hasNext()) {
        Object repository = repositories.getRepositoryFor(domainClass);
        if (repository != null && repository instanceof CrudRepository) {
            return (CrudRepository<Object, Serializable>)repository;
        }
    }

    return null;
}
 
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:15,代码来源:RepositoryFinder.java


示例4: repositoriesAreAssignedToAppropriateStores

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Test
public void repositoriesAreAssignedToAppropriateStores() {

	Repositories repositories = new Repositories(context);

	assertThat(repositories.getEntityInformationFor(Customer.class), is(instanceOf(JpaEntityInformation.class)));
	assertThat(repositories.getEntityInformationFor(Order.class), is(instanceOf(MongoEntityInformation.class)));
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:9,代码来源:ApplicationConfigurationTest.java


示例5: setApplicationContext

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
    Class<?>[] classes = GenericTypeResolver.resolveTypeArguments(this.getClass(), RepoBasedConverter.class);
    Class<?> clazz = classes[0];
    this.repositories = new Repositories(context);
    this.entityInformation = (JpaEntityInformation<S, ID>) repositories.getEntityInformationFor(clazz);
    this.genericJpaRepository = (GenericJpaRepository<S, ID>) repositories.getRepositoryFor(clazz);
    this.useCache = genericJpaRepository instanceof CachingJpaRepository;
}
 
开发者ID:slyak,项目名称:spring-data-jpa-extra,代码行数:10,代码来源:RepoBasedConverter.java


示例6: ContentSearchRestController

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Autowired 
public ContentSearchRestController(Repositories repositories, ContentStoreService stores, PagedResourcesAssembler<Object> assembler) {
	super(assembler);
	
	this.repositories = repositories;
	this.stores = stores;
	this.reflectionService = new ReflectionServiceImpl();
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:9,代码来源:ContentSearchRestController.java


示例7: ContentPropertyCollectionRestController

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Autowired(required=false)
public ContentPropertyCollectionRestController(ApplicationContext context, ContentStoreService stores, StoreByteRangeHttpRequestHandler handler) {
	super();
	try {
		this.repositories = context.getBean(Repositories.class);
	} catch (BeansException be) {
		this.repositories = new Repositories(context);
	}
	this.storeService = stores;
	this.handler = handler;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:12,代码来源:ContentPropertyCollectionRestController.java


示例8: ContentEntityRestController

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Autowired 
public ContentEntityRestController(ApplicationContext context, ContentStoreService storeService, StoreByteRangeHttpRequestHandler handler) {
	try {
		this.repositories = context.getBean(Repositories.class);
	} catch (BeansException be) {
		this.repositories = new Repositories(context);
	}
	this.storeService = storeService;
	this.handler = handler;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:11,代码来源:ContentEntityRestController.java


示例9: findOne

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public static Object findOne(Repositories repositories, String repository, String id) 
		throws HttpRequestMethodNotSupportedException {
	
	Object domainObj = null;
	
	RepositoryInformation ri = findRepositoryInformation(repositories, repository);

	if (ri == null) {
		throw new ResourceNotFoundException();
	}
	
	Class<?> domainObjClazz = ri.getDomainType();
	Class<?> idClazz = ri.getIdType();
	
	Method findOneMethod = ri.getCrudMethods().getFindOneMethod();
	if (findOneMethod == null) {
		throw new HttpRequestMethodNotSupportedException("fineOne");
	}
	
	Object oid = new DefaultConversionService().convert(id, idClazz);
	domainObj = ReflectionUtils.invokeMethod(findOneMethod, repositories.getRepositoryFor(domainObjClazz), oid);
	
	if (null == domainObj) {
		throw new ResourceNotFoundException();
	}
	
	return domainObj;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:29,代码来源:AbstractContentPropertyController.java


示例10: findAll

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public static Iterable findAll(Repositories repositories, String repository) 
		throws HttpRequestMethodNotSupportedException {
	
	Iterable entities = null;
	
	RepositoryInformation ri = findRepositoryInformation(repositories, repository);

	if (ri == null) {
		throw new ResourceNotFoundException();
	}
	
	Class<?> domainObjClazz = ri.getDomainType();
	Class<?> idClazz = ri.getIdType();
	
	Method findAllMethod = ri.getCrudMethods().getFindAllMethod();
	if (findAllMethod == null) {
		throw new HttpRequestMethodNotSupportedException("fineAll");
	}
	
	entities = (Iterable)ReflectionUtils.invokeMethod(findAllMethod, repositories.getRepositoryFor(domainObjClazz));
	
	if (null == entities) {
		throw new ResourceNotFoundException();
	}
	
	return entities;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:28,代码来源:AbstractContentPropertyController.java


示例11: findRepositoryInformation

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public static RepositoryInformation findRepositoryInformation(Repositories repositories, String repository) {
	RepositoryInformation ri = null;
	for (Class<?> clazz : repositories) {
		RepositoryInformation candidate = repositories.getRepositoryInformationFor(clazz);
		if (candidate == null) {
			continue;
		}
		if (repository.equals(RepositoryUtils.repositoryPath(candidate))) {
			ri = repositories.getRepositoryInformationFor(clazz);
			break;
		}
	}
	return ri;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:15,代码来源:AbstractContentPropertyController.java


示例12: ContentPropertyRestController

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Autowired(required=false)
public ContentPropertyRestController(ApplicationContext context, ContentStoreService storeService, StoreByteRangeHttpRequestHandler handler) {
	super();
	try {
		this.repositories = context.getBean(Repositories.class);
	} catch (BeansException be) {
		this.repositories = new Repositories(context);
	}
	this.storeService = storeService;
	this.handler = handler;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:12,代码来源:ContentPropertyRestController.java


示例13: replaceContentInternal

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
private void replaceContentInternal(Repositories repositories,
									ContentStoreService stores,
									String repository,
									String id, 
									String contentProperty, 
									String contentId, 
									String mimeType,
									InputStream stream) 
		throws HttpRequestMethodNotSupportedException {

	Object domainObj = findOne(repositories, repository, id);

	PersistentProperty<?> property = this.getContentPropertyDefinition(repositories.getPersistentEntity(domainObj.getClass()), contentProperty);
	
	Object contentPropertyValue = this.getContentProperty(domainObj, property, contentId); 
	
	if (BeanUtils.hasFieldWithAnnotation(contentPropertyValue, MimeType.class)) {
		BeanUtils.setFieldWithAnnotation(contentPropertyValue, MimeType.class, mimeType);
	}
	
	Class<?> contentEntityClass = ContentPropertyUtils.getContentPropertyType(property);
	
	ContentStoreInfo info = ContentStoreUtils.findContentStore(storeService, contentEntityClass);
	info.getImpementation().setContent(contentPropertyValue, stream);
	
	save(repositories, domainObj);
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:28,代码来源:ContentPropertyRestController.java


示例14: ApplicationStructureController

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Autowired
public ApplicationStructureController(ApplicationStructureBuilder applicationStructureBuilder, RepositoryRestConfiguration configuration, Repositories repositories, ResourceMappings mappings) {
    Assert.notNull(applicationStructureBuilder, "ApplicationStructureBuilder must not be null!");
    Assert.notNull(configuration, "RepositoryRestConfiguration must not be null!");
    Assert.notNull(repositories, "Repositories must not be null!");
    Assert.notNull(mappings, "ResourceMappings must not be null!");

    this.applicationStructureBuilder = applicationStructureBuilder;
    this.configuration = configuration;
    this.repositories = repositories;
    this.mappings = mappings;
}
 
开发者ID:thomasletsch,项目名称:moserp,代码行数:13,代码来源:ApplicationStructureController.java


示例15: findPersistentEntity

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public static PersistentEntity<?,?> findPersistentEntity(Repositories repositories, 
												  Class<?> domainType) {

	PersistentEntity<?, ?> persistentEntity = repositories.getPersistentEntity(domainType);
	return persistentEntity;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:7,代码来源:PersistentEntityUtils.java


示例16: init

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@PostConstruct
public void init() {
    repositories = new Repositories(applicationContext);
    repositoryInvokerFactory = new DefaultRepositoryInvokerFactory(repositories, conversionService);
}
 
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:6,代码来源:DomainController.java


示例17: init

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@PostConstruct
public void init() {
    repositories = new Repositories(context);
}
 
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:5,代码来源:MenuPreparer.java


示例18: setApplicationContext

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
	repositories = new Repositories(applicationContext);
}
 
开发者ID:yonadev,项目名称:yona-server,代码行数:6,代码来源:RepositoryProvider.java


示例19: setRepositories

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public static void setRepositories(Repositories repositories)
{
	RepositoryProvider.repositories = repositories;
}
 
开发者ID:yonadev,项目名称:yona-server,代码行数:5,代码来源:RepositoryProvider.java


示例20: DemoRepositoryEntityLinks

import org.springframework.data.repository.support.Repositories; //导入依赖的package包/类
public DemoRepositoryEntityLinks(Repositories repositories,
		ResourceMappings mappings, RepositoryRestConfiguration config, HateoasPageableHandlerMethodArgumentResolver resolver,org.springframework.plugin.core.PluginRegistry<BackendIdConverter,Class<?>> idConverters) {
	super(repositories, mappings, config, resolver,idConverters);
	this.resourceMappings = mappings;
	this.config = config;
}
 
开发者ID:michaellavelle,项目名称:spring-data-dynamodb-demo,代码行数:7,代码来源:DemoRepositoryEntityLinks.java



注:本文中的org.springframework.data.repository.support.Repositories类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProviderQueryResult类代码示例发布时间:2022-05-22
下一篇:
Java SVNCopySource类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap