Ejemplo n.º 1
0
  /**
   * 获取自列表的列与掩码的Map
   *
   * @param conn
   * @param PO
   * @param dictMetadata
   * @param DOMeta
   * @throws Exception
   */
  protected static java.util.Map getSelfEnumColViewMap(
      JConnection conn, JParamObject PO, DictMetadata dictMetadata) throws Exception {
    if (dictMetadata == null) {
      return null;
    }
    TableMetadata tableMetadata = dictMetadata.getTableMetadata();
    if (tableMetadata == null) {
      return null;
    }
    java.util.List colList = tableMetadata.getColList();
    if (colList == null) return null;

    // 获取各列的掩码
    java.util.Map map = new java.util.HashMap();
    String objid = tableMetadata.getString("OBJ_ID", "");
    Statement st = null;
    ResultSet rs = null;
    String sql = " select * from SYS_SELFENUM" + " where OBJ_ID='" + objid + "' order by COL_DISP";
    try {
      st = conn.createStatement();
      rs = st.executeQuery(sql);
      while (rs.next()) {
        String colid = rs.getString("COL_ID");
        String colval = rs.getString("COL_VAL");
        String colnote = rs.getString("F_NOTE");
        if (colval == null || colval.length() == 0) {
          colval = " ";
        }
        if (colnote == null || colnote.length() == 0) {
          colnote = colval;
        }
        String view = (String) map.get(colid);
        if (view == null) {
          map.put(colid, colval + ":" + colnote);
        } else {
          if (view.endsWith(";")) {
            view = view.substring(0, view.length() - 1);
          }
          map.put(colid, view + ";" + colval + ":" + colnote);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      conn.BackStatement(st, rs);
    }
    return map;
  }
Ejemplo n.º 2
0
 protected static void getSYS_DCT_CST(
     JConnection conn, JParamObject PO, DictMetadata dictMetadata, DCTMetaData DCTMeta)
     throws Exception {
   if (DCTMeta == null) return;
   TableMetadata tableMetadata = dictMetadata.getTableMetadata();
   String DCT_ID = tableMetadata.getString("OBJ_ID", "");
   java.util.List list = new ArrayList();
   java.util.Map SYS_DCT_CST = DCTMeta.getSYS_DCT_CST();
   if (SYS_DCT_CST == null) return;
   ;
   for (Iterator it = SYS_DCT_CST.keySet().iterator(); it.hasNext(); ) {
     Object key = it.next();
     Object val = SYS_DCT_CST.get(key);
     StubObject so = new StubObject();
     so.setString("UNIT_ID", "");
     so.setString("DCT_ID", DCT_ID);
     so.setString("DCT_KEY", (String) key);
     so.setString("DCT_VALUE", (String) val);
     list.add(so);
   }
   dictMetadata.setObject("SYS_DCT_CST", list);
 }