@Override
  public SpecimenRequirement createSpecimenRequirement(SpecimenRequirementDetail detail) {
    SpecimenRequirement requirement = new SpecimenRequirement();
    OpenSpecimenException ose = new OpenSpecimenException(ErrorType.USER_ERROR);

    requirement.setId(detail.getId());
    requirement.setName(detail.getName());
    requirement.setLineage(Specimen.NEW);

    setCode(detail, requirement, ose);
    setLabelFormat(detail, requirement, ose);
    setLabelAutoPrintMode(detail, requirement, ose);
    setSpecimenClass(detail, requirement, ose);
    setSpecimenType(detail, requirement, ose);
    setAnatomicSite(detail, requirement, ose);
    setLaterality(detail, requirement, ose);
    setPathologyStatus(detail, requirement, ose);
    setStorageType(detail, requirement, ose);
    setInitialQty(detail, requirement, ose);
    setConcentration(detail, requirement, ose);
    setCollector(detail, requirement, ose);
    setCollectionProcedure(detail, requirement, ose);
    setCollectionContainer(detail, requirement, ose);
    setReceiver(detail, requirement, ose);
    setCpe(detail, requirement, ose);

    requirement.setSortOrder(detail.getSortOrder());
    requirement.setActivityStatus(Status.ACTIVITY_STATUS_ACTIVE.getStatus());

    ose.checkAndThrow();

    setSpecimenPoolReqs(detail, requirement, ose);
    return requirement;
  }
  @Override
  public SpecimenRequirement createForUpdate(String lineage, SpecimenRequirementDetail req) {
    SpecimenRequirement sr = new SpecimenRequirement();

    OpenSpecimenException ose = new OpenSpecimenException(ErrorType.USER_ERROR);
    sr.setName(req.getName());
    sr.setSortOrder(req.getSortOrder());

    //
    // Specimen class and type are set here so that properties dependent on these can
    // be calculated and set appropriately.
    //
    setSpecimenClass(req, sr, ose);
    setSpecimenType(req, sr, ose);
    setInitialQty(req, sr, ose);
    setStorageType(req, sr, ose);
    setLabelFormat(req, sr, ose);
    setLabelAutoPrintMode(req, sr, ose);
    setCode(req, sr, ose);
    setConcentration(req, sr, ose);

    if (!lineage.equals(Specimen.ALIQUOT)) {
      setPathologyStatus(req, sr, ose);
    }

    if (!lineage.equals(Specimen.NEW)) {
      return sr;
    }

    setAnatomicSite(req, sr, ose);
    setLaterality(req, sr, ose);
    setCollector(req, sr, ose);
    setCollectionProcedure(req, sr, ose);
    setCollectionContainer(req, sr, ose);
    setReceiver(req, sr, ose);

    ose.checkAndThrow();
    return sr;
  }