本文整理汇总了Java中org.springframework.data.mongodb.repository.MongoRepository类的典型用法代码示例。如果您正苦于以下问题:Java MongoRepository类的具体用法?Java MongoRepository怎么用?Java MongoRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MongoRepository类属于org.springframework.data.mongodb.repository包,在下文中一共展示了MongoRepository类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: advanceStateOfMetadataDocument
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
public <S extends MetadataDocument, T extends MongoRepository<S, String>>
Event advanceStateOfMetadataDocument(T repository, S metadataDocument, ValidationState targetState) {
if (!metadataDocument.allowedStateTransitions().contains(targetState)) {
throw new IllegalStateException(String.format(
"It is not possible to transition document '%s: %s' from state '%s' to state '%s'",
metadataDocument.getClass().getSimpleName(),
metadataDocument.getId(),
metadataDocument.getValidationState(),
targetState));
}
final Event event = new ValidationEvent(metadataDocument.getValidationState(), targetState);
metadataDocument.addEvent(event).enactStateTransition(targetState);
repository.save(metadataDocument);
// is this an event that needs to be posted to a queue?
postMessageIfRequired(metadataDocument, targetState);
return event;
}
示例2: deleteOrphaned
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
private <T extends MongoRepository> void deleteOrphaned(T repository, String idPattern) {
Pattern pattern = Pattern.compile(idPattern);
Set<String> missingIds = Sets.newHashSet();
attachmentRepository.findAll().forEach(a -> {
if(a.getPath() != null) {
Matcher m = pattern.matcher(a.getPath());
if(m.find()) {
String id = m.group(1);
if(missingIds.contains(id) || repository.findOne(id) == null) {
if(!missingIds.contains(id)) missingIds.add(id);
attachmentRepository.delete(a);
fileStoreService.delete(a.getId());
}
}
} else {
attachmentRepository.delete(a);
fileStoreService.delete(a.getId());
}
});
}
示例3: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
@Override
protected MongoRepository<ProjectConfig, String> getRepository() {
return projectConfigRepository;
}
示例4: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
@Override
protected MongoRepository<StudyDatasetConfig, String> getRepository() {
return datasetConfigRepository;
}
示例5: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
@Override
protected MongoRepository<HarmonizationPopulationConfig, String> getRepository() {
return harmonizationPopulationConfigRepository;
}
示例6: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
@Override
protected MongoRepository<HarmonizationStudyConfig, String> getRepository() {
return harmonizationConfigRepository;
}
示例7: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
@Override
protected MongoRepository<HarmonizationDatasetConfig, String> getRepository() {
return datasetConfigRepository;
}
示例8: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
@Override
protected MongoRepository<HarmonizationStudy, String> getRepository() {
return harmonizationStudyRepository;
}
示例9: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
@Override
protected MongoRepository<Study, String> getRepository() {
return studyRepository;
}
示例10: BaseController
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
/**
* Constructor for base controller
* @param repository
*/
public BaseController(MongoRepository<T, String> repository) {
this.repository = repository;
}
示例11: getMongoStorage
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
/**
* <p>getMongoStorage.</p>
*
* @return a {@link org.springframework.data.mongodb.repository.MongoRepository} object.
*/
protected abstract MongoRepository<T, String> getMongoStorage();
示例12: getRepository
import org.springframework.data.mongodb.repository.MongoRepository; //导入依赖的package包/类
protected abstract MongoRepository<T, String> getRepository();