org.springframework.data.mongodb.core.MongoTemplate.getCollectionName()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.springframework.data.mongodb.core.MongoTemplate.getCollectionName()方法的一些代码示例,展示了MongoTemplate.getCollectionName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongoTemplate.getCollectionName()方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.MongoTemplate
类名称:MongoTemplate
方法名:getCollectionName

MongoTemplate.getCollectionName介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
   * Returns the collection the given entity type shall be persisted to.
   *
   * @param entityClass must not be {@literal null}.
   * @return
   */
  private String getCollectionNameForEntity(Class<? extends ChangeSetBacked> entityClass) {
    return mongoTemplate.getCollectionName(entityClass);
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private String getCollectionName() {
  return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private String getCollectionName(Aggregation aggregation) {
    if (StringUtils.hasText(collection)) {
      return collection;
    }
    if (aggregation instanceof TypedAggregation) {
      TypedAggregation<?> typedAggregation = (TypedAggregation<?>) aggregation;
      if (typedAggregation.getInputType() != null) {
        return template.getCollectionName(typedAggregation.getInputType());
      }
    }
    return template.getCollectionName(domainType);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private String getCollectionName() {
    return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private String getCollectionName() {
  return StringUtils.hasText(collection) ? collection : template.getCollectionName(domainType);
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private String getCollectionName(Aggregation aggregation) {
    if (StringUtils.hasText(collection)) {
      return collection;
    }
    if (aggregation instanceof TypedAggregation) {
      TypedAggregation<?> typedAggregation = (TypedAggregation<?>) aggregation;
      if (typedAggregation.getInputType() != null) {
        return template.getCollectionName(typedAggregation.getInputType());
      }
    }
    return template.getCollectionName(domainType);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb-cross-store

/**
   * Returns the collection the given entity type shall be persisted to.
   *
   * @param entityClass must not be {@literal null}.
   * @return
   */
  private String getCollectionNameForEntity(Class<? extends ChangeSetBacked> entityClass) {
    return mongoTemplate.getCollectionName(entityClass);
  }
}

代码示例来源:origin: stackoverflow.com

@Autowired
  private MongoTemplate mongoTemplate;    
DBCollection collection = mongoTemplate.getCollection(mongoTemplate.getCollectionName(MyDocument.class)));

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void findLatestWithCallback(Queryable filter, Sort sort, List<String> contentFields, long limit,
    DocumentCallbackHandler callbackHandler) {
  List<AggregationOperation> operations = latestLaunchesAggregationOperationsList(filter);
  operations.add(sort(sort));
  operations.add(limit(limit));
  DBObject results = mongoTemplate.aggregate(newAggregation(operations), mongoTemplate.getCollectionName(Launch.class), Launch.class)
      .getRawResults();
  BasicDBList result = (BasicDBList) results.get(RESULT);
  result.stream().map(it -> (DBObject) it).forEach(callbackHandler::processDocument);
}

代码示例来源:origin: com.epam.reportportal/commons-dao

private List<Launch> findLatest(Queryable filter, Pageable pageable) {
  List<AggregationOperation> operations = latestLaunchesAggregationOperationsList(filter);
  operations.add(sort(pageable.getSort()));
  operations.add(skip((long) pageable.getPageNumber() * pageable.getPageSize()));
  operations.add(limit(pageable.getPageSize()));
  return mongoTemplate.aggregate(newAggregation(operations), mongoTemplate.getCollectionName(Launch.class), Launch.class)
      .getMappedResults();
}

代码示例来源:origin: statefulj/statefulj

void onAfterDelete(Class<?> stateful, DBObject obj) {
    if (stateful != null && getClazz().isAssignableFrom(stateful)) {
      Criteria criteria = new Criteria("managedId").is(obj.get(this.getIdField().getName())).
          and("managedCollection").is(getMongoTemplate().getCollectionName(getClazz())).
          and("managedField").is(this.getStateField().getName());
      this.getMongoTemplate().remove(new Query(criteria), StateDocumentImpl.class);
    }
  }
}

代码示例来源:origin: statefulj/statefulj

protected StateDocumentImpl createStateDocument(T stateful) throws IllegalArgumentException, IllegalAccessException, SecurityException, NoSuchFieldException {
  StateDocumentImpl stateDoc = new StateDocumentImpl();
  stateDoc.setPersisted(false);
  stateDoc.setId(new ObjectId().toHexString());
  stateDoc.setState(getStartState().getName());
  stateDoc.setManagedCollection(getMongoTemplate().getCollectionName(stateful.getClass()));
  stateDoc.setManagedField(this.getStateField().getName());
  setStateDocument(stateful, stateDoc);
  return stateDoc;
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public List<RetryObject> findRetries(String launchId) {
  Aggregation aggregation = newAggregation(match(where(LAUNCH_REFERENCE).is(launchId).and("retryProcessed").exists(true)),
      sort(new Sort(Sort.Direction.ASC, "start_time")), group(Fields.fields("$uniqueId")).push(ROOT).as("retries")
  );
  return mongoTemplate.aggregate(aggregation, mongoTemplate.getCollectionName(TestItem.class), RetryObject.class).getMappedResults();
}

相关文章