Esempio n. 1
0
  /**
   * This method gives the review information of a state
   *
   * @return stateReview(StateReview) corresponding to the state review code.
   */
  private StateReview getStateReview() {
    Map<String, String> eoStateReview = s2sUtilService.getEOStateReview(pdDoc);
    StateReviewCodeTypeDataType.Enum stateReviewCodeType = null;
    String strReview = eoStateReview.get(S2SConstants.YNQ_ANSWER);
    String stateReviewData = null;
    String stateReviewDate = null;

    if (STATE_REVIEW_YES.equals(strReview)) {
      stateReviewCodeType = StateReviewCodeTypeDataType.Y_YES;
      stateReviewDate = eoStateReview.get(S2SConstants.YNQ_REVIEW_DATE);
    } else if (STATE_REVIEW_NO.equals(strReview)) {
      stateReviewData = eoStateReview.get(S2SConstants.YNQ_STATE_REVIEW_DATA);
      if (stateReviewData != null && S2SConstants.YNQ_STATE_NOT_COVERED.equals(stateReviewData)) {
        stateReviewCodeType = StateReviewCodeTypeDataType.PROGRAM_IS_NOT_COVERED_BY_E_O_12372;
      } else if (stateReviewData != null
          && S2SConstants.YNQ_STATE_NOT_SELECTED.equals(stateReviewData)) {
        stateReviewCodeType =
            StateReviewCodeTypeDataType.PROGRAM_HAS_NOT_BEEN_SELECTED_BY_STATE_FOR_REVIEW;
      }
    }
    StateReview stateReview = StateReview.Factory.newInstance();
    stateReview.setStateReviewCodeType(stateReviewCodeType);
    if (stateReviewDate != null) {
      stateReview.setStateReviewDate(s2sUtilService.convertDateStringToCalendar(stateReviewDate));
    }
    return stateReview;
  }
Esempio n. 2
0
  /**
   * This method is used to get ApplicationType for the form RRSF424
   *
   * @return ApplicationType corresponding to the proposal type code.
   */
  private ApplicationType getApplicationType() {
    ApplicationType applicationType = ApplicationType.Factory.newInstance();
    Map<String, String> submissionInfo = s2sUtilService.getSubmissionType(pdDoc);
    if (pdDoc.getDevelopmentProposal().getProposalTypeCode() != null
        && Integer.parseInt(pdDoc.getDevelopmentProposal().getProposalTypeCode())
            < PROPOSAL_TYPE_CODE_6) {
      // Check <6 to ensure that if proposalType='TASk ORDER", it must not
      // set. THis is because enum ApplicationType has no
      // entry for TASK ORDER
      ApplicationTypeCodeDataType.Enum applicationTypeCodeDataType =
          ApplicationTypeCodeDataType.Enum.forInt(
              Integer.parseInt(pdDoc.getDevelopmentProposal().getProposalTypeCode()));
      applicationType.setApplicationTypeCode(applicationTypeCodeDataType);
      if (Integer.parseInt(pdDoc.getDevelopmentProposal().getProposalTypeCode())
          == ApplicationTypeCodeDataType.INT_REVISION) {
        String revisionCode = null;
        if (submissionInfo.get(S2SConstants.KEY_REVISION_CODE) != null) {
          revisionCode = submissionInfo.get(S2SConstants.KEY_REVISION_CODE);
          RevisionTypeCodeDataType.Enum revisionCodeApplication =
              RevisionTypeCodeDataType.Enum.forString(revisionCode);
          applicationType.setRevisionCode(revisionCodeApplication);
        }
        String revisionCodeOtherDesc = null;
        if (submissionInfo.get(S2SConstants.KEY_REVISION_OTHER_DESCRIPTION) != null) {
          revisionCodeOtherDesc = submissionInfo.get(S2SConstants.KEY_REVISION_OTHER_DESCRIPTION);
          applicationType.setRevisionCodeOtherExplanation(revisionCodeOtherDesc);
        }
      }
    }
    YesNoDataType.Enum answer = null;
    String answerdetails = getAnswer(ANSWER_128);
    if (answerdetails != null && !answerdetails.equals(NOT_ANSWERED)) {
      answer =
          answerdetails.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
              ? YesNoDataType.Y_YES
              : YesNoDataType.N_NO;
      applicationType.setIsOtherAgencySubmission(answer);
    } else {
      applicationType.setIsOtherAgencySubmission(null);
    }

    if (answer != null && answer.equals(YesNoDataType.Y_YES)) {
      String answerExplanation = getAnswer(ANSWER_111);
      if (answerExplanation != null) {
        Collection<ArgValueLookup> argDescription =
            KcServiceLocator.getService(ArgValueLookupService.class).findAllArgValueLookups();
        if (argDescription != null) {
          for (ArgValueLookup argValue : argDescription) {
            if (argValue.getValue().equals(answerExplanation)) {
              String description = argValue.getDescription();
              String submissionExplanation = description.substring(5);
              if (submissionExplanation.length() > ANSWER_EXPLANATION_MAX_LENGTH) {
                applicationType.setOtherAgencySubmissionExplanation(
                    submissionExplanation.substring(0, ANSWER_EXPLANATION_MAX_LENGTH));
              } else {
                applicationType.setOtherAgencySubmissionExplanation(submissionExplanation);
              }
            }
          }
        }
      }
    }
    return applicationType;
  }