public ProrateForm setupForm(long id) {
    Prorate obj = findById(Prorate.class, id);

    ProrateForm form = new ProrateForm();
    form.setId(obj.getId());
    form.setFiscalYear(obj.getFiscalYear());
    form.setProrateFactor1stPayment(obj.getProrateFactor1stPayment());
    form.setProrateFactor2ndPayment(obj.getProrateFactor2ndPayment());
    form.setFundingSources(obj.getFundingSources());
    form.setTotalFirstPayment(obj.getTotalFirstPayment());
    form.setTotalSecondPayment(obj.getTotalSecondPayment());
    form.setTotalDistribution(obj.getTotalDistribution());
    return form;
  }
  public ProrateForm setProrateFormData(ProrateForm form, Prorate obj) {
    form.setId(obj.getId());
    form.setFiscalYear(obj.getFiscalYear());
    form.setProrateFactor1stPayment(obj.getProrateFactor1stPayment());
    form.setProrateFactor2ndPayment(obj.getProrateFactor2ndPayment());
    form.setFundingSources(obj.getFundingSources());
    form.setTotalFirstPayment(obj.getTotalFirstPayment());
    form.setTotalSecondPayment(obj.getTotalSecondPayment());
    form.setTotalDistribution(obj.getTotalDistribution());

    return form;
  }
 public void saveOrUpdate(ProrateForm form) {
   long id = form.getId();
   Prorate obj = findById(Prorate.class, id);
   if (obj == null) {
     obj = new Prorate();
   }
   obj.setFiscalYear(form.getFiscalYear());
   obj.setProrateFactor1stPayment(form.getProrateFactor1stPayment());
   obj.setProrateFactor2ndPayment(form.getProrateFactor2ndPayment());
   obj.setFundingSources(form.getFundingSources());
   obj.setTotalFirstPayment(form.getTotalFirstPayment());
   obj.setTotalSecondPayment(form.getTotalSecondPayment());
   obj.setTotalDistribution(form.getTotalDistribution());
   saveOrUpdate(obj);
 }
  public ProrateForm setTransportationData(
      ProrateForm form, List<Transportation> transportationList, UserInfo userInfo) {
    List<ProrateTransportationGrid> ltg = form.getProrateTransportationGridList();
    for (Transportation a : transportationList) {
      ProrateTransportationGrid transGrid = new ProrateTransportationGrid();
      transGrid.setDistrictNumber(a.getDistrictNumber());
      try {
        transGrid.setOrganizationName(
            userInfo
                .getDistrictMap()
                .get(
                    a
                        .getDistrictNumber())); // referenceDataManager.getDistrictName((a.getDistrictNumber())));
      } catch (Exception e) {
        transGrid.setOrganizationName("No Matching District Name");
      }
      transGrid.setFirstPayment(a.getFirstPayment());
      transGrid.setSecondPayment(a.getSecondPayment());
      transGrid.setDistrictDistribution(a.getDistrictDistribution());
      ltg.add(transGrid);
    }

    return form;
  }