Exemplo n.º 1
0
  /**
   * Populate investigators
   *
   * @param document The <code>{@link ProposalDevelopmentDocument}</code> to populate investigators
   *     on
   */
  public void populateInvestigators(ProposalDevelopmentDocument document) {
    // Populate Investigators from a proposal document's persons
    LOG.debug("Populating Investigators");
    LOG.debug("Clearing investigator list");
    document.getDevelopmentProposal().getInvestigators().clear();

    for (ProposalPerson person : document.getDevelopmentProposal().getProposalPersons()) {
      LOG.debug(person.getFullName() + " is " + person.isInvestigator());

      if (person.isInvestigator()) {
        LOG.info("Adding investigator " + person.getFullName());
        document.getDevelopmentProposal().getInvestigators().add(person);
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public List<ProposalCreditSplitListDto> createCreditSplitListItems(
      List<ProposalPerson> investigators) {
    List<ProposalCreditSplitListDto> creditSplitListItems =
        new ArrayList<ProposalCreditSplitListDto>();
    Map<String, ProposalPersonCreditSplit> totalInvestigatorSplits =
        new HashMap<String, ProposalPersonCreditSplit>();
    for (ProposalPerson investigator : investigators) {
      ProposalCreditSplitListDto investigatorLine = new ProposalCreditSplitListDto();
      investigatorLine.setDescription(investigator.getFullName());
      investigatorLine.setLineType("investigator");
      investigatorLine.getCreditSplits().addAll(investigator.getCreditSplits());
      creditSplitListItems.add(investigatorLine);
      for (ProposalPersonCreditSplit invesitgatorCreditSplit : investigator.getCreditSplits()) {
        if (totalInvestigatorSplits.containsKey(invesitgatorCreditSplit.getInvCreditTypeCode())) {
          ProposalPersonCreditSplit creditSplit =
              totalInvestigatorSplits.get(invesitgatorCreditSplit.getInvCreditTypeCode());
          creditSplit.setCredit(creditSplit.getCredit().add(invesitgatorCreditSplit.getCredit()));
        } else {
          ProposalPersonCreditSplit creditSplit = new ProposalPersonCreditSplit();
          creditSplit.setCredit(invesitgatorCreditSplit.getCredit());
          totalInvestigatorSplits.put(invesitgatorCreditSplit.getInvCreditTypeCode(), creditSplit);
        }
      }

      Map<String, ProposalUnitCreditSplit> totalUnitSplits =
          new HashMap<String, ProposalUnitCreditSplit>();
      for (ProposalPersonUnit unit : investigator.getUnits()) {
        ProposalCreditSplitListDto unitLine = new ProposalCreditSplitListDto();
        unitLine.setDescription(unit.getUnitNumber() + " - " + unit.getUnit().getUnitName());
        unitLine.getCreditSplits().addAll(unit.getCreditSplits());
        unitLine.setLineType("unit");
        creditSplitListItems.add(unitLine);
        for (ProposalUnitCreditSplit unitCreditSplit : unit.getCreditSplits()) {
          if (totalUnitSplits.containsKey(unitCreditSplit.getInvCreditTypeCode())) {
            ProposalUnitCreditSplit creditSplit =
                totalUnitSplits.get(unitCreditSplit.getInvCreditTypeCode());
            creditSplit.setCredit(creditSplit.getCredit().add(unitCreditSplit.getCredit()));
          } else {
            ProposalUnitCreditSplit creditSplit = new ProposalUnitCreditSplit();
            creditSplit.setCredit(unitCreditSplit.getCredit());
            totalUnitSplits.put(unitCreditSplit.getInvCreditTypeCode(), creditSplit);
          }
        }
      }

      ProposalCreditSplitListDto unitTotalLine = new ProposalCreditSplitListDto();
      unitTotalLine.setDescription("Unit Total:");
      unitTotalLine.setLineType("unit-total");
      for (Map.Entry<String, ProposalUnitCreditSplit> entry : totalUnitSplits.entrySet()) {
        unitTotalLine.getCreditSplits().add(0, entry.getValue());
      }
      creditSplitListItems.add(unitTotalLine);
    }

    ProposalCreditSplitListDto investigatorTotalLine = new ProposalCreditSplitListDto();
    investigatorTotalLine.setDescription("Investigator Total:");
    investigatorTotalLine.setLineType("investigator-total");
    for (Map.Entry<String, ProposalPersonCreditSplit> entry : totalInvestigatorSplits.entrySet()) {
      investigatorTotalLine.getCreditSplits().add(0, entry.getValue());
    }
    creditSplitListItems.add(investigatorTotalLine);

    return creditSplitListItems;
  }