@Override protected void prepareData(ProposalDevelopmentDocument document) throws Exception { ProposalDevelopmentBudgetExt budget = new ProposalDevelopmentBudgetExt(); budget.setBudgetId(new Long("000001")); budget.setBudgetStatus("1"); budget.setStartDate(new Date(new Long("1183316613046"))); budget.setEndDate(new Date(new Long("1214852613046"))); budget.setOnOffCampusFlag("Y"); budget.setOhRateClassCode("1"); budget.setUrRateClassCode("1"); budget.setModularBudgetFlag(false); budget.setParentDocumentTypeCode("PRDV"); budget.setDevelopmentProposal(document.getDevelopmentProposal()); budget.setName("test document description"); List<BudgetPeriod> budgetPeriods = new ArrayList<BudgetPeriod>(); BudgetPeriod budgetPeriod = new BudgetPeriod(); budgetPeriod.setBudgetPeriod(1); budgetPeriod.setStartDate(new Date(new Long("1183316613046"))); budgetPeriod.setEndDate(new Date(new Long("1214852613046"))); budgetPeriods.add(budgetPeriod); budget.setBudgetPeriods(budgetPeriods); budget = getService(DataObjectService.class).save(budget); List<ProposalDevelopmentBudgetExt> budgets = new ArrayList<>(); budgets.add(budget); document.getDevelopmentProposal().setBudgets(budgets); document.getDevelopmentProposal().setFinalBudget(budget); }
@SuppressWarnings("serial") @Before public void setUp() throws Exception { kcPersonService = KcServiceLocator.getService(KcPersonService.class); budgetPersonService = (BudgetPersonServiceImpl) KcServiceLocator.getService(BudgetPersonService.class); budget = new ProposalDevelopmentBudgetExt() { int nextVal = 1; public Integer getHackedDocumentNextValue(String documentComponentIdKey) { return nextVal++; } }; startDate = createDate(2010, 1, 1); endDate = createDate(2010, 12, 30); budget.setStartDate(startDate); budget.setEndDate(endDate); budget.setDevelopmentProposal(new DevelopmentProposal()); }
@Override protected void prepareData(ProposalDevelopmentDocument document) throws Exception { Organization organization = getService(DataObjectService.class) .findUnique( Organization.class, QueryByCriteria.Builder.forAttribute("organizationId", "000001").build()); document.getDevelopmentProposal().getApplicantOrganization().setOrganization(organization); NarrativeAttachment narrativeAttachment = new NarrativeAttachment(); DefaultResourceLoader resourceLoader = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader()); Resource resource = resourceLoader.getResource(S2STestConstants.ATT_PACKAGE + "/exercise2.pdf"); InputStream inputStream = resource.getInputStream(); BufferedInputStream bis = new BufferedInputStream(inputStream); byte[] narrativePdf = new byte[bis.available()]; narrativeAttachment.setData(narrativePdf); narrativeAttachment.setName("exercise1"); Narrative narrative = new Narrative(); List<Narrative> narrativeList = new ArrayList<Narrative>(); narrative.setDevelopmentProposal(document.getDevelopmentProposal()); NarrativeType narrativeType = getService(DataObjectService.class) .findUnique( NarrativeType.class, QueryByCriteria.Builder.forAttribute("code", "7").build()); narrative.setName("exercise1"); narrative.setNarrativeType(narrativeType); narrative.setNarrativeTypeCode(narrativeType.getCode()); narrative.setNarrativeAttachment(narrativeAttachment); narrative.setModuleNumber(1); narrative.setModuleSequenceNumber(1); narrative.setModuleStatusCode("C"); narrativeList.add(narrative); document.getDevelopmentProposal().setNarratives(narrativeList); List<ProposalPerson> proposalPersons = new ArrayList<ProposalPerson>(); ProposalPerson principalInvestigator = new ProposalPerson(); principalInvestigator.setFirstName("ALAN"); principalInvestigator.setLastName("MCAFEE"); principalInvestigator.setProposalPersonRoleId("PI"); principalInvestigator.setPersonId("0001"); principalInvestigator.setRolodexId(0010); principalInvestigator.setProposalPersonNumber(1); principalInvestigator.setDevelopmentProposal(document.getDevelopmentProposal()); proposalPersons.add(principalInvestigator); document.getDevelopmentProposal().setProposalPersons(proposalPersons); ProposalDevelopmentBudgetExt proposalDevelopmentBudgetExt = new ProposalDevelopmentBudgetExt(); proposalDevelopmentBudgetExt.setDevelopmentProposal(document.getDevelopmentProposal()); proposalDevelopmentBudgetExt.setBudgetVersionNumber(1); proposalDevelopmentBudgetExt.setBudgetStatus("1"); proposalDevelopmentBudgetExt.setBudgetId(1L); proposalDevelopmentBudgetExt.setName("test Document Description"); proposalDevelopmentBudgetExt.setOnOffCampusFlag("Y"); proposalDevelopmentBudgetExt.setStartDate(new Date(new Long("1183316613046"))); proposalDevelopmentBudgetExt.setEndDate(new Date(new Long("1214852613046"))); proposalDevelopmentBudgetExt.setOhRateTypeCode("1"); proposalDevelopmentBudgetExt.setOhRateClassCode("1"); proposalDevelopmentBudgetExt.setModularBudgetFlag(false); proposalDevelopmentBudgetExt.setUrRateClassCode("1"); List<BudgetPeriod> budgetPeriods = new ArrayList<BudgetPeriod>(); BudgetPeriod budgetPeriod = new BudgetPeriod(); budgetPeriod.setBudgetPeriodId(1L); budgetPeriod.setStartDate(new Date(new Long("1183316613046"))); budgetPeriod.setEndDate(new Date(new Long("1214852613046"))); budgetPeriod.setBudgetPeriod(1); budgetPeriod.setBudget(proposalDevelopmentBudgetExt); budgetPeriods.add(budgetPeriod); proposalDevelopmentBudgetExt.setBudgetPeriods(budgetPeriods); List<ProposalDevelopmentBudgetExt> proposalDevelopmentBudgetExtList = new ArrayList<ProposalDevelopmentBudgetExt>(); proposalDevelopmentBudgetExtList.add(proposalDevelopmentBudgetExt); document.getDevelopmentProposal().setBudgets(proposalDevelopmentBudgetExtList); document.getDevelopmentProposal().setFinalBudget(proposalDevelopmentBudgetExt); }