private RRBudgetDocument getRRBudget ( ) { deleteAutoGenNarratives ( ) ; RRBudgetDocument rrBudgetDocument = RRBudgetDocument . Factory . newInstance ( ) ; RRBudget rrBudget = RRBudget . Factory . newInstance ( ) ; rrBudget . setFormVersion ( FormVersion . v1_1 . getVersion ( ) ) ; if ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) != null ) { rrBudget . setDUNSID ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getDunsNumber ( ) ) ; rrBudget . setOrganizationName ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getOrganizationName ( ) ) ; } rrBudget . setBudgetType ( BudgetTypeDataType . PROJECT ) ; // Set default values for mandatory fields rrBudget . setBudgetYear1 ( BudgetYear1DataType . Factory . newInstance ( ) ) ; List < BudgetPeriodDto > budgetperiodList ; BudgetSummaryDto budgetSummary = null ; try { validateBudgetForForm ( pdDoc ) ; budgetperiodList = s2sBudgetCalculatorService . getBudgetPeriods ( pdDoc ) ; budgetSummary = s2sBudgetCalculatorService . getBudgetInfo ( pdDoc , budgetperiodList ) ; } catch ( S2SException e ) { LOG . error ( e . getMessage ( ) , e ) ; return rrBudgetDocument ; } for ( BudgetPeriodDto budgetPeriodData : budgetperiodList ) { if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P1 . getNum ( ) ) { rrBudget . setBudgetYear1 ( getBudgetYear1DataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P2 . getNum ( ) ) { rrBudget . setBudgetYear2 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P3 . getNum ( ) ) { rrBudget . setBudgetYear3 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P4 . getNum ( ) ) { rrBudget . setBudgetYear4 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P5 . getNum ( ) ) { rrBudget . setBudgetYear5 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } } for ( BudgetPeriodDto budgetPeriodData : budgetperiodList ) { if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P1 . getNum ( ) ) { rrBudget . setBudgetYear1 ( getBudgetJustificationAttachment ( rrBudget . getBudgetYear1 ( ) ) ) ; } } rrBudget . setBudgetSummary ( getBudgetSummary ( budgetSummary ) ) ; rrBudgetDocument . setRRBudget ( rrBudget ) ; return rrBudgetDocument ; }
This method returns RRBudgetDocument object based on proposal development document which contains the informations such as DUNSID OrganizationName BudgetType BudgetYear and BudgetSummary .