コード例 #1
0
 private OperatingCostBean getBean(OperatingCost operatingCosts) {
   OperatingCostBean bean = new OperatingCostBean();
   bean.setSlipNo(operatingCosts.getSlipNo());
   bean.setFuelCost(operatingCosts.getFuelCost());
   bean.setFuelLitres(operatingCosts.getFuelLitres());
   bean.setOilCost(operatingCosts.getOilCost());
   bean.setOilLitres(operatingCosts.getOilLitres());
   bean.setSpeedometer(operatingCosts.getSpeedometer());
   bean.setTransactionDate(operatingCosts.getTransactionDate());
   bean.setDriverId(operatingCosts.getDriverId());
   bean.setId(operatingCosts.getId());
   return bean;
 }
コード例 #2
0
  private OperatingCost getEntity(FieldGroup binder) {
    final OperatingCostBean operatingCostsBean =
        ((BeanItem<OperatingCostBean>) binder.getItemDataSource()).getBean();
    final Person driver =
        PersonFacade.getPersonService().findById(operatingCostsBean.getDriverId());

    final OperatingCost operatingCosts =
        new OperatingCost.Builder(new Date())
            .fuelCost(operatingCostsBean.getFuelCost())
            .fuelLitres(operatingCostsBean.getFuelLitres())
            .oilCost(operatingCostsBean.getOilCost())
            .oilLitres(operatingCostsBean.getOilLitres())
            .speedometer(operatingCostsBean.getSpeedometer())
            .slipNo(operatingCostsBean.getSlipNo())
            .driver(driver)
            .id(operatingCostsBean.getId())
            .build();

    return operatingCosts;
  }