Ejemplo n.º 1
0
  public static ElementBean getMsg(Properties ctx, String text) {
    String language = Env.getContext(ctx, UdiConstants.LANGUAGE_CTX_PARAM);

    if (language == null || language.trim().length() == 0) {
      language = Language.AD_Language_en_US;
    }

    String msg = Msg.getElement(language, text, true);

    if (msg == null || msg == "") {
      msg = Msg.translate(language, text);
    }

    if (msg == null || msg == "") {
      msg = text;
    }

    int ind = msg.indexOf(Env.NL);
    if (ind != -1) msg = msg.substring(0, ind);

    ElementBean elementBean = new ElementBean();
    elementBean.setColumnName(text);
    elementBean.setDescription(msg);
    elementBean.setHelp(msg);
    elementBean.setName(msg);
    elementBean.setPrintName(msg);

    return elementBean;
  }
Ejemplo n.º 2
0
  private static ElementBean getTrl(String sql) {
    PreparedStatement pstmt = DB.prepareStatement(sql, null);

    ElementBean retElementBean = null;
    try {
      ResultSet rs = pstmt.executeQuery();
      if (rs.next()) {
        retElementBean = new ElementBean();
        retElementBean.setColumnName(rs.getString(1));
        retElementBean.setName(rs.getString(2));
        retElementBean.setPrintName(rs.getString(3));
        retElementBean.setDescription(rs.getString(4));
        retElementBean.setHelp(rs.getString(5));
      } else {
        return null;
      }
      rs.close();
    } catch (Exception ex) {
      log.severe("Could retrieve element translation with sql: " + sql);
    } finally {
      try {
        pstmt.close();
      } catch (Exception ex) {
      }
    }

    return retElementBean;
  }
Ejemplo n.º 3
0
 private static ElementBean getUnknownElementBean(Properties ctx, String columnName) {
   ElementBean elementBean = new ElementBean();
   elementBean.setColumnName(columnName);
   elementBean.setDescription("Undefined column with name: " + columnName);
   elementBean.setHelp(elementBean.getDescription());
   elementBean.setName(columnName);
   elementBean.setPrintName(columnName);
   return elementBean;
 }