當前位置: 首頁>>代碼示例>>Java>>正文


Java MongoRepository類代碼示例

本文整理匯總了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;
}
 
開發者ID:HumanCellAtlas,項目名稱:ingest-core,代碼行數:21,代碼來源:StateEngine.java

示例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());
    }
  });
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:24,代碼來源:AttachmentsCleanupUpgrade.java

示例3: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
@Override
protected MongoRepository<ProjectConfig, String> getRepository() {
  return projectConfigRepository;
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:5,代碼來源:ProjectConfigService.java

示例4: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
@Override
protected MongoRepository<StudyDatasetConfig, String> getRepository() {
  return datasetConfigRepository;
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:5,代碼來源:StudyDatasetConfigService.java

示例5: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
@Override
protected MongoRepository<HarmonizationPopulationConfig, String> getRepository() {
  return harmonizationPopulationConfigRepository;
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:5,代碼來源:HarmonizationPopulationConfigService.java

示例6: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
@Override
protected MongoRepository<HarmonizationStudyConfig, String> getRepository() {
  return harmonizationConfigRepository;
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:5,代碼來源:HarmonizationStudyConfigService.java

示例7: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
@Override
protected MongoRepository<HarmonizationDatasetConfig, String> getRepository() {
  return datasetConfigRepository;
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:5,代碼來源:HarmonizationDatasetConfigService.java

示例8: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
@Override
protected MongoRepository<HarmonizationStudy, String> getRepository() {
  return harmonizationStudyRepository;
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:5,代碼來源:HarmonizationStudyService.java

示例9: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
@Override
protected MongoRepository<Study, String> getRepository() {
  return studyRepository;
}
 
開發者ID:obiba,項目名稱:mica2,代碼行數:5,代碼來源:IndividualStudyService.java

示例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;
}
 
開發者ID:denis-rodionov,項目名稱:cityoffice,代碼行數:8,代碼來源:BaseController.java

示例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();
 
開發者ID:exo-archives,項目名稱:acceptance,代碼行數:7,代碼來源:AbstractMongoCRUDService.java

示例12: getRepository

import org.springframework.data.mongodb.repository.MongoRepository; //導入依賴的package包/類
protected abstract MongoRepository<T, String> getRepository(); 
開發者ID:obiba,項目名稱:mica2,代碼行數:2,代碼來源:EntityConfigService.java


注:本文中的org.springframework.data.mongodb.repository.MongoRepository類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。