Ejemplo n.º 1
0
 /**
  * This method will set the values to salary type attributes and finally return the array of
  * Salary type.
  */
 protected BudgetSalary getSalaryType() {
   List<SalaryTypeVO> salaryTypeVoList = new ArrayList<SalaryTypeVO>();
   getBudgetCalculationService().calculateBudgetSummaryTotals(budget);
   for (Map.Entry<BudgetCategoryType, List<CostElement>> entry :
       budget.getObjectCodeListByBudgetCategoryType().entrySet()) {
     if (isPersonnel(entry.getKey().getCode())) {
       for (CostElement costElement : entry.getValue()) {
         addSalaryDataForCostElement(costElement, salaryTypeVoList);
       }
     }
   }
   boolean includeNonPersonnel = false;
   setSalaryTypesForLineItemCalcuAmount(salaryTypeVoList, includeNonPersonnel);
   List<SalaryType> salaryTypeList = getListOfSalaryTypeXmlObjects(salaryTypeVoList);
   BudgetSalary budgetSalary = getBudgetSalaryTypeXmlObject();
   budgetSalary.setSalaryArray(salaryTypeList.toArray(new SalaryType[0]));
   return budgetSalary;
 }
  /**
   * This method will set the values to BudgetSalary Attributes and finally return the Budget Salary
   * xml object.
   *
   * @return Budget Salary xml object
   */
  protected BudgetSalary getBudgetSalaryTypeXmlObject() {
    BudgetSalary budgetSalary = BudgetSalary.Factory.newInstance();
    BudgetParent bdP = budget.getBudgetParent();
    String parentNumber = bdP.getParentNumber();

    if (parentNumber != null) {
      budgetSalary.setProposalNumber(parentNumber);
      budgetSalary.setParentTypeName(bdP.getParentTypeName());
    }
    setBudgetSalaryTypeBasicInformation(budgetSalary);

    String principleInvestigatorName = bdP.getParentPIName();
    if (principleInvestigatorName != null) {
      budgetSalary.setPIName(principleInvestigatorName);
    }
    if (bdP != null && bdP.getParentTitle() != null) {
      budgetSalary.setTitle(bdP.getParentTitle());
    }
    return budgetSalary;
  }
 /*
  * This method will set the basic information of budget salary type like
  * version number,start date , end date and budget periods size
  */
 private void setBudgetSalaryTypeBasicInformation(BudgetSalary budgetSalary) {
   if (budget.getBudgetVersionNumber() != null) {
     budgetSalary.setBudgetVersion(budget.getBudgetVersionNumber());
   }
   budgetSalary.setCurrentDate(dateTimeService.getCurrentCalendar());
   if (budget.getStartDate() != null) {
     budgetSalary.setStartDate(dateTimeService.getCalendar(budget.getStartDate()));
   }
   if (budget.getEndDate() != null) {
     budgetSalary.setEndDate(dateTimeService.getCalendar(budget.getEndDate()));
   }
   if (budget.getBudgetPeriods() != null) {
     budgetSalary.setTotalPeriod(budget.getBudgetPeriods().size());
   }
   if (budget.getComments() != null) {
     if (budget.getPrintBudgetCommentFlag() != null
         && budget.getPrintBudgetCommentFlag().equals("true"))
       budgetSalary.setComments(budget.getComments());
   }
   budget.setPrintBudgetCommentFlag(null);
 }