/** * 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; }