当前位置: 首页>>代码示例>>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;未经允许,请勿转载。