Example #1
0
  private Sample feedSampleData(Sample sample) throws Exception {
    sample.setProjectId(projectId);
    sample.setProjectName(projectName);

    // set project level by adding 1 to selected parent project's level
    if (sample.getParentSampleName() == null || sample.getParentSampleName().equals("0"))
      sample.setParentSampleName(null);

    String parentSampleName = sample.getParentSampleName();
    if (parentSampleName != null && !parentSampleName.isEmpty() && !parentSampleName.equals("0")) {
      Sample selectedParentSample = readPersister.getSample(projectId, parentSampleName);
      sample.setSampleLevel(selectedParentSample.getSampleLevel() + 1);
    } else {
      sample.setParentSampleId(null);
      sample.setSampleLevel(1);
    }

    return sample;
  }