Package org.svnadmin.entity

Examples of org.svnadmin.entity.I18n


    //from cache
    if(cache.containsKey(key)){
      return format(cache.get(key), args);
    }
    //from database
    I18n i18n = i18nService.getI18n(lang,id);
    if(i18n == null){//数据库里不存在
      i18n = new I18n();
      i18n.setLang(lang);
      i18n.setId(id);
      i18n.setLbl(defValue);
      i18nService.insert(i18n);
    }
   
    cache.put(key, i18n.getLbl());//put into cache
   
    return format(i18n.getLbl(), args);
  }
View Full Code Here


      int index = 1;
      pstmt.setString(index++, id);

      rs = pstmt.executeQuery();
      while (rs.next()) {
        I18n i18n = readI18n(rs);
        results.put(i18n.getLang(),i18n);
      }
    } catch (SQLException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    } finally {
View Full Code Here

   * @return i18n对象
   * @throws SQLException
   *             JDBC异常
   */
  I18n readI18n(ResultSet rs) throws SQLException {
    I18n result = new I18n();
    result.setLang(rs.getString("lang"));
    result.setId(rs.getString("id"));
    result.setLbl(rs.getString("lbl"));
    return result;
  }
View Full Code Here

      conn = this.getConnection();
      pstmt = conn.prepareStatement(sql);
     
      rs = pstmt.executeQuery();
      while (rs.next()) {
        I18n i18n = new I18n();
        i18n.setId(rs.getString("id"));
        i18n.setTotal(rs.getInt("total"));
        results.add(i18n);
      }
    } catch (SQLException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
View Full Code Here

    }
    int i =0;
    List<I18n> list = new ArrayList<I18n>();
    String lang;
    while((lang = request.getParameter("lang_"+i)) != null){
      I18n i18n =new I18n();
      i18n.setId(id);
      i18n.setLang(lang);
      i18n.setLbl(request.getParameter("lbl_"+i));
      list.add(i18n);
     
      i++;
    }
    i18nService.save(list);
View Full Code Here

  }
 
  @Override
  protected void save(HttpServletRequest request, HttpServletResponse response) {

    I18n entity = new I18n();
    entity.setLang(request.getParameter("lang"));
    entity.setId(entity.getLang());
    entity.setLbl(request.getParameter("lbl"));
   
    request.setAttribute("entity", entity);
   
    if(i18nService.getI18n(entity.getLang(), entity.getId())!=null){
      throw new RuntimeException(I18N.getLbl(request, "i18n.error.duplicatelang", "已经存在相同的语言"));
    }
    //保存
    i18nService.insert(entity);
   
    //当前语言
    I18n entity2 = new I18n();
    entity2.setLang(I18N.getDefaultLang(request));
    entity2.setId(entity.getLang());
    entity2.setLbl(entity.getLbl());
    if(i18nService.getI18n(entity2.getLang(), entity2.getId()) == null){
      i18nService.insert(entity2);
    }
  }
View Full Code Here

TOP

Related Classes of org.svnadmin.entity.I18n

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.