Package com.jpoweredcart.common.entity.localisation

Examples of com.jpoweredcart.common.entity.localisation.LengthClass


      " mcd ON (mc.length_class_id = mcd.length_class_id)";
    final Map<String, LengthClass> dataMap = new HashMap<String, LengthClass>();
    getJdbcOperations().query(sql, new RowCallbackHandler(){
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        LengthClass lc = new LengthClass();
        lc.setId(rs.getInt("length_class_id"));
        lc.setTitle(rs.getString("title"));
        lc.setUnit(rs.getString("unit"));
        lc.setValue(rs.getBigDecimal("value"));
        String key = rs.getInt("language_id")+"_"+lc.getId();
        dataMap.put(key, lc);
      }
    });
    this.lengthClassMap = dataMap;
  }
View Full Code Here


    if(ObjectUtils.equals(fromClassId, toClassId)){
      return value;
    }
   
    BigDecimal from = BigDecimal.ZERO;
    LengthClass fromLengthClass = lengthClassMap.get(languageId+"_"+fromClassId);
    if(fromLengthClass!=null){
      from = fromLengthClass.getValue();
    }
    BigDecimal to = BigDecimal.ZERO;
    LengthClass toLengthClass = lengthClassMap.get(languageId+"_"+toClassId);
    if(toLengthClass!=null){
      to = toLengthClass.getValue();
    }
   
    return value.multiply(to.divide(from));
  }
View Full Code Here

    return numberFormat.format(value)+" "+getUnit(languageId, classId);
  }
 
  @Override
  public String getUnit(Integer languageId, Integer classId) {
    LengthClass lengthClass = lengthClassMap.get(languageId+"_"+classId);
    if(lengthClass!=null){
      return lengthClass.getUnit();
    }
    return "";
  }
View Full Code Here

  @RequestMapping(value="/edit/{id}")
  public String edit(@PathVariable("id") Integer id, Model model){
   
    checkModifyPermission();
   
    LengthClass lcForm = lengthClassAdminModel.getForm(id);
    model.addAttribute("lengthClassForm", lcForm);
    return "/admin/localisation/lengthClassForm";
  }
View Full Code Here

    List<LengthClass> lengthClassList = getJdbcOperations().query(query.getSql(),
        query.getParameters(), new LengthClassRowMapper(){
          @Override
          public LengthClass mapRow(ResultSet rs, int rowNum)
              throws SQLException {
            LengthClass lc = super.mapRow(rs, rowNum);
            lc.setTitle(rs.getString("title"));
            lc.setUnit(rs.getString("unit"));
            return lc;
          }
    });
    return lengthClassList;
  }
View Full Code Here

TOP

Related Classes of com.jpoweredcart.common.entity.localisation.LengthClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.