/**
   * @param source
   * @param target
   * @param subjectPersonId
   * @param focalPersonId
   * @param factLists
   * @throws ImproperUsageException
   * @throws DataFormatException
   * @throws InvalidDataException
   */
  public static void pullIn(
      org.opencds.vmr.v1_0.schema.ScheduledProcedure source,
      ScheduledProcedure target,
      String subjectPersonId,
      String focalPersonId,
      FactLists factLists)
      throws ImproperUsageException, DataFormatException, InvalidDataException {

    String _METHODNAME = "pullIn(): ";

    if (source == null) {
      return;
    }

    try {
      ProcedureBaseMapper.pullIn(source, target, subjectPersonId, focalPersonId, factLists);
    } catch (ImproperUsageException u) {
      String errStr = _METHODNAME + "Caught unexpected ImproperUsageException: " + u.getMessage();
      logger.error(errStr, u);
      throw new RuntimeException(errStr);
    }

    if (source.getProcedureTime() != null)
      target.setProcedureTime(MappingUtility.iVLTS2IVLDateInternal(source.getProcedureTime()));

    factLists.internalScheduledProcedureList.add(target);

    // pull in nested RelatedEntities and RelatedClinicalStatements
    NestedObjectsMapper.pullInClinicalStatementNestedObjects(
        source, target.getId(), subjectPersonId, focalPersonId, factLists);

    return;
  }