/**
   * This method is used to get Clinical Trial information
   *
   * @return ClinicalTrial object containing Clinical Trail Details.
   */
  private ClinicalTrial getClinicalTrial() {

    ClinicalTrial clinicalTrial = ClinicalTrial.Factory.newInstance();
    String answer = null;
    String subAnswer = null;
    answer = getAnswer(IS_CLINICAL_TRIAL);
    if (answer != null) {
      if (!answer.equals(NOT_ANSWERED)) {
        if (S2SConstants.PROPOSAL_YNQ_ANSWER_Y.equals(answer)) {
          clinicalTrial.setIsClinicalTrial(YesNoDataType.Y_YES);
          subAnswer = getAnswer(PHASE_III_CLINICAL_TRIAL);
          if (subAnswer != null && !subAnswer.equals(NOT_ANSWERED)) {
            if (S2SConstants.PROPOSAL_YNQ_ANSWER_Y.equals(subAnswer)) {
              clinicalTrial.setIsPhaseIIIClinicalTrial(YesNoDataType.Y_YES);
            } else {
              clinicalTrial.setIsPhaseIIIClinicalTrial(YesNoDataType.N_NO);
            }
          } else {
            clinicalTrial.setIsPhaseIIIClinicalTrial(null);
          }
        } else {
          clinicalTrial.setIsClinicalTrial(YesNoDataType.N_NO);
        }
      }
    }
    return clinicalTrial;
  }
  /**
   * This method is used to get information of Stem Cells for the form PHS398CoverPage
   *
   * @return StemCells object containing information about Human stem Cells involvement.
   */
  private StemCells getStemCells() {

    StemCells stemCells = StemCells.Factory.newInstance();
    Enum answers = YesNoDataType.N_NO;
    String childAnswer = null;
    String answer = getAnswer(IS_HUMAN_STEM_CELLS_INVOLVED);
    if (answer != null) {
      if (!answer.equals(NOT_ANSWERED)) {
        answers =
            S2SConstants.PROPOSAL_YNQ_ANSWER_Y.equals(getAnswer(IS_HUMAN_STEM_CELLS_INVOLVED))
                ? YesNoDataType.Y_YES
                : YesNoDataType.N_NO;
        if (S2SConstants.PROPOSAL_YNQ_ANSWER_Y.equals(answer)) {
          stemCells.setIsHumanStemCellsInvolved(YesNoDataType.Y_YES);
          String subAnswer = getAnswer(SPECIFIC_STEM_CELL_LINE);
          if (subAnswer != null) {
            if (!subAnswer.equals(NOT_ANSWERED)) {
              if (S2SConstants.PROPOSAL_YNQ_ANSWER_Y.equals(subAnswer)) {
                stemCells.setStemCellsIndicator(YesNoDataType.N_NO);
                childAnswer = getAnswers(REGISTRATION_NUMBER);
              } else {
                stemCells.setStemCellsIndicator(YesNoDataType.Y_YES);
              }
            }
          }
          if (childAnswer != null) {
            if (S2SConstants.VALUE_UNKNOWN.equalsIgnoreCase(childAnswer)) {
              stemCells.setStemCellsIndicator(answers);
            } else {
              List<String> cellLines = getCellLines(childAnswer);
              if (cellLines.size() > 0) {
                stemCells.setCellLinesArray(cellLines.toArray(new String[0]));
              }
            }
          }
        } else {
          stemCells.setIsHumanStemCellsInvolved(YesNoDataType.N_NO);
        }
      }
    }
    return stemCells;
  }
  /**
   * This method YesNo data type Lobbying answers based on the ProposalYnq QuestionId
   *
   * @return answer (YesNoDataType.Enum) corresponding to Ynq question id.
   */
  private YesNoDataType.Enum getLobbyingAnswer() {
    YesNoDataType.Enum answer = YesNoDataType.N_NO;

    for (ProposalPerson proposalPerson : pdDoc.getDevelopmentProposal().getProposalPersons()) {
      if (proposalPerson.getProposalPersonRoleId() != null
              && proposalPerson.getProposalPersonRoleId().equals(PRINCIPAL_INVESTIGATOR)
          || proposalPerson.getProposalPersonRoleId().equals(PI_C0_INVESTIGATOR)) {
        ProposalPersonModuleQuestionnaireBean moduleQuestionnaireBean =
            new ProposalPersonModuleQuestionnaireBean(
                pdDoc.getDevelopmentProposal(), proposalPerson);
        List<AnswerHeader> headers =
            getQuestionnaireAnswerService().getQuestionnaireAnswer(moduleQuestionnaireBean);
        AnswerHeader answerHeader = headers.get(0);
        List<Answer> certificationAnswers = answerHeader.getAnswers();

        for (Answer certificatonAnswer : certificationAnswers) {
          if (certificatonAnswer != null
              && PROPOSAL_YNQ_LOBBYING_ACTIVITIES.equals(
                  certificatonAnswer.getQuestion().getQuestionId())
              && S2SConstants.PROPOSAL_YNQ_ANSWER_Y.equals(certificatonAnswer.getAnswer())) {
            return YesNoDataType.Y_YES;
          }
        }
      }
    }
    Organization organization =
        getOrganizationFromDevelopmentProposal(pdDoc.getDevelopmentProposal());
    List<OrganizationYnq> organizationYnqs = null;
    if (organization != null && organization.getOrganizationId() != null) {
      organizationYnqs = getOrganizationYNQ(organization.getOrganizationId());
    }
    for (OrganizationYnq organizationYnq : organizationYnqs) {
      if (organizationYnq.getQuestionId().equals(LOBBYING_QUESTION_ID)) {
        if (getAnswerFromOrganizationYnq(organizationYnq)) {
          return YesNoDataType.Y_YES;
        }
      }
    }
    return answer;
  }