本文整理匯總了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();