protected ScienceKeyword getScienceKeyword(Object element) {
   return getDataObjectService()
       .findUnique(
           ScienceKeyword.class, QueryByCriteria.Builder.forAttribute("code", element).build());
 }
예제 #2
0
  @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);
  }
 protected ExemptionType getExemptionType(Object element) {
   return getDataObjectService()
       .findUnique(
           ExemptionType.class, QueryByCriteria.Builder.forAttribute("code", element).build());
 }