コード例 #1
0
  @Override
  public Page<ModelOutput> findByCourseId(String courseId, boolean onlyLastRun, Pageable pageable) {

    Page<ModelOutput> page = null;
    if (onlyLastRun) {
      RiskConfidence riskConfidence =
          riskConfidenceRepository.findTopByCourseIdOrderByDateCreatedDesc(courseId);
      if (riskConfidence != null) {
        page =
            convert(
                riskConfidenceRepository.findByGroupIdAndCourseId(
                    riskConfidence.getGroupId(), courseId, pageable),
                pageable);
      }
    } else {
      page = convert(riskConfidenceRepository.findByCourseId(courseId, pageable), pageable);
    }

    return page;
  }
コード例 #2
0
  private RiskConfidence toRiskConfidence(ModelOutput modelOutput) {
    RiskConfidence riskConfidence = new RiskConfidence();
    if (modelOutput.getOutput() != null) {
      riskConfidence.setAlternativeId((String) modelOutput.getOutput().get("ALTERNATIVE_ID"));
      riskConfidence.setCourseId((String) modelOutput.getOutput().get("COURSE_ID"));
      riskConfidence.setModelRiskConfidence(
          (String) modelOutput.getOutput().get("MODEL_RISK_CONFIDENCE"));
    }
    riskConfidence.setDateCreated(new Date());
    riskConfidence.setGroupId(modelOutput.getModelRunId());

    return riskConfidence;
  }
コード例 #3
0
  private ModelOutput fromRiskConfidence(RiskConfidence riskConfidence) {
    ModelOutput modelOutput = new ModelOutput();
    modelOutput.setId(String.valueOf(riskConfidence.getId()));
    modelOutput.setCreatedDate(riskConfidence.getDateCreated());
    modelOutput.setModelRunId(riskConfidence.getGroupId());

    Map<String, Object> output = new HashMap<String, Object>();
    output.put("ALTERNATIVE_ID", riskConfidence.getAlternativeId());
    output.put("COURSE_ID", riskConfidence.getCourseId());
    output.put("MODEL_RISK_CONFIDENCE", riskConfidence.getModelRiskConfidence());

    modelOutput.setOutput(output);
    return modelOutput;
  }