Exemplo n.º 1
0
  /**
   * This method returns Investigator
   * status,DisclosureLobbyingActivities,ExploratoryResearch,HistoricPlaces, HighResolutionGraphics
   * and AccomplishmentRenewal information for the OtherInfo type.
   *
   * @param nsfCoverPage13
   * @return OtherInfo object containing other informations about the principal investigator.
   */
  private void setOtherInfo(NSFCoverPage13 nsfCoverPage13) {
    OtherInfo otherInfo = OtherInfo.Factory.newInstance();
    PIInfo pInfo = PIInfo.Factory.newInstance();
    for (Answer questionnaireAnswer :
        s2sUtilService.getQuestionnaireAnswers(
            pdDoc.getDevelopmentProposal(), getNamespace(), getFormName())) {
      String answer = questionnaireAnswer.getAnswer();
      int questionId = questionnaireAnswer.getQuestionNumber();

      if (answer != null) {
        switch (questionId) {
          case QUESTION_CURRENT_PI:
            pInfo.setIsCurrentPI(
                answer.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
                    ? YesNoDataType.Y_YES
                    : YesNoDataType.N_NO);
            break;
          case QUESTION_BEGIN_INVESTIGATOR:
            otherInfo.setIsBeginInvestigator(
                answer.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
                    ? YesNoDataType.Y_YES
                    : YesNoDataType.N_NO);
            break;
          case QUESTION_EARLY_CONCEPT_GRANT:
            otherInfo.setIsEarlyConceptGrant(
                answer.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
                    ? YesNoDataType.Y_YES
                    : YesNoDataType.N_NO);
            break;
          case QUESTION_RAPIDRESPONSE_GRANT:
            otherInfo.setIsRapidResponseGrant(
                answer.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
                    ? YesNoDataType.Y_YES
                    : YesNoDataType.N_NO);
            break;
          case QUESTION_ACCOMPLISHMENT_RENEWAL:
            otherInfo.setIsAccomplishmentRenewal(
                answer.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
                    ? YesNoDataType.Y_YES
                    : YesNoDataType.N_NO);
            break;
          case QUESTION_RESOLUTION_GRAPHICS:
            otherInfo.setIsHighResolutionGraphics(
                answer.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
                    ? YesNoDataType.Y_YES
                    : YesNoDataType.N_NO);
            break;
          default:
            break;
        }
      }
    }
    nsfCoverPage13.setPIInfo(pInfo);
    otherInfo.setIsDisclosureLobbyingActivities(getLobbyingAnswer());
    nsfCoverPage13.setOtherInfo(otherInfo);
  }
  /*
   * This method will get the Answer for sub question
   */
  private String getAnswer(String questionId) {

    String answer = null;
    if (answerHeaders != null && !answerHeaders.isEmpty()) {
      for (AnswerHeader answerHeader : answerHeaders) {
        List<Answer> answerDetails = answerHeader.getAnswers();
        for (Answer answers : answerDetails) {
          if (questionId.equals(answers.getQuestion().getQuestionId())) {
            answer = answers.getAnswer();
          }
        }
      }
    }
    return answer;
  }
Exemplo n.º 3
0
  @Override
  public void performApplyModel(Object model, LifecycleElement parent) {
    Object myBo =
        ObjectPropertyUtils.getPropertyValue(
            model, KcBindingInfo.getParentBindingInfo(getBindingInfo()));
    Answer answer = (Answer) myBo;
    setControl(
        (Control)
            ComponentFactory.getNewComponentInstance(
                getControlMappings().get(answer.getQuestion().getQuestionTypeId().toString())));
    getControl().getCssClasses().add("answer");
    if (StringUtils.isNotBlank(answer.getQuestion().getLookupClass())) {
      if (useSuggest) {
        getSuggest().setRender(true);
        getSuggest().setValuePropertyName(answer.getQuestion().getLookupReturn());
        getSuggest()
            .getSuggestQuery()
            .setDataObjectClassName(answer.getQuestion().getLookupClass());
      }

      getQuickfinder().setRender(true);
      getQuickfinder().setDataObjectClassName(answer.getQuestion().getLookupClass());
      getQuickfinder()
          .getFieldConversions()
          .put(answer.getQuestion().getLookupReturn(), getPropertyName());
    }
    super.performApplyModel(model, parent);
  }
Exemplo n.º 4
0
  /**
   * 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;
  }
  /*
   * This method will get the childAnswer for sub question
   */
  private String getAnswers(String questionId) {

    String answer = null;
    String childAnswer = null;
    StringBuilder stringBuilder = new StringBuilder();
    if (answerHeaders != null && !answerHeaders.isEmpty()) {
      for (AnswerHeader answerHeader : answerHeaders) {
        List<Answer> answerDetails = answerHeader.getAnswers();
        for (Answer answers : answerDetails) {
          if (questionId.equals(answers.getQuestion().getQuestionId())) {
            answer = answers.getAnswer();
            if (answer != null) {
              if (!answer.equals(NOT_ANSWERED)) {
                stringBuilder.append(answer);
                stringBuilder.append(",");
              }
            }
            childAnswer = stringBuilder.toString();
          }
        }
      }
    }
    return childAnswer;
  }
  /**
   * Setting the Coversheet and ProjectNarrative details according the Questionnaire Answers.
   *
   * @param coverSheet
   * @param projectNarrative
   */
  private void setQuestionnaireAnswers(CoverSheet coverSheet, ProjectNarrative projectNarrative) {
    List<Answer> answers =
        s2sUtilService.getQuestionnaireAnswers(
            pdDoc.getDevelopmentProposal(), getNamespace(), getFormName());
    for (Answer answer : answers) {
      switch (answer.getQuestion().getQuestionIdAsInteger()) {
        case PRELIMINARY:
          YesNoNotApplicableDataType.Enum yesNoNotApplicableDataType =
              YesNoNotApplicableDataType.N_NO;
          if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) {
            yesNoNotApplicableDataType = YesNoNotApplicableDataType.Y_YES;
          } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) {
            yesNoNotApplicableDataType = YesNoNotApplicableDataType.N_NO;
          } else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) {
            yesNoNotApplicableDataType = YesNoNotApplicableDataType.NA_NOT_APPLICABLE;
          }
          coverSheet.setCheckFullApp(yesNoNotApplicableDataType);
          break;
        case MERIT_REVIEW:
          if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) {
            projectNarrative.setCheckMeritReview(YesNoNotApplicableDataType.Y_YES);
          } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) {
            projectNarrative.setCheckMeritReview(YesNoNotApplicableDataType.N_NO);
          } else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) {
            projectNarrative.setCheckMeritReview(YesNoNotApplicableDataType.NA_NOT_APPLICABLE);
          }
          break;

        case MENTORING:
          if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) {
            projectNarrative.setCheckMentoring(YesNoNotApplicableDataType.Y_YES);
          } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) {
            projectNarrative.setCheckMentoring(YesNoNotApplicableDataType.N_NO);
          }
          break;

        case PRIOR_SUPPORT:
          // Does narrative include info regarding prior support?
          if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer()))
            projectNarrative.setCheckPriorSupport(YesNoNotApplicableDataType.Y_YES);
          if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer()))
            projectNarrative.setCheckPriorSupport(YesNoNotApplicableDataType.N_NO);
          if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer()))
            projectNarrative.setCheckPriorSupport(YesNoNotApplicableDataType.NA_NOT_APPLICABLE);
          break;
        case HR_QUESTION:
          /*
           * HR Info that is mandatory for renwals from academic
           * institutions.
           */
          if (QUESTIONNAIRE_ANSWER_NO.equals(answer)) {
            projectNarrative.setCheckHRInfo(YesNoNotApplicableDataType.N_NO);
          }
          break;
        case HR_REQUIRED_INFO:
          /*
           * HR Info that is mandatory for renwals from academic
           * institutions.
           */
          if (QUESTIONNAIRE_ANSWER_YES.equals(answer)) {
            projectNarrative.setCheckHRInfo(YesNoNotApplicableDataType.Y_YES);
          }
          break;
        default:
          break;
      }
    }
  }